3 ms·
The insane things people do in Bash sometimes...although I don't think anything can top the x86 Assembler that was written entirely in Bash: http://lists.gnu.o
by unsignedqword 10y ago
The insane things people do in Bash sometimes...although I don't think anything can top the x86 Assembler that was written entirely in Bash:
http://lists.gnu.org/archive/html/bug-bash/2001-02/msg00054.html http://lists.gnu.org/archive/html/bug-bash/2001-02/msg00054....
- ravenstine 10y agoNeat!
- skynetv2 10y agowhy ....
- foxhill 10y agoto call this an assembler is to not give it credit where it's due - this is not an assembler, it's much more than that. it's a set of functions for bash that when sourced make the assembly a valid bash script which then runs and assembles itself. this is genius.
- gcr 10y agoIt's using the shell's own tokenizer to parse asm! That's glorious! I don't really understand why the code works since I can't read x86 asm yet, but I think how it works is reasonably clear. Each instruction has its own bash function that writes its opcodes to the output file and the asm script to be assembled is (I think) sourced directly into the running shell session.