Replies: 1 comment 3 replies
-
There is actually a BASIC compiler already present --- it's ancient and eccentric, though. https://github.com/davidgiven/ack/tree/default/lang/basic There's an example in Adding a new target in the ACK is probably easier than most other compilers, but still pretty hard. There are two real parts: the platform-dependent stuff (in I'd probably recommend starting with your z80-based machine, but using the 8080 code generator, because that already exists and is known to work. This basically involves copying In terms of adding a new code generator: you have a choice of three. In terms of adding a new language: it's reasonably straightforward. There's a C library which generates the EM bytecode; you emit stack-based code, and this does the rest. See |
Beta Was this translation helpful? Give feedback.
-
Writing or even just modifying compilers is way outside my current experience, so I would like a few pointers on what I would need to learn before attempting to modify ACK.
First of all, I would like to add several new target platforms. These would be emulated 8-bit machines with a Z80 or 6809 processor. I would hope to also support physical machines, but I don't currently have access to any.
If I manage that, I would like to add support for a new programming language. This would be ANSI Full BASIC (without the optional graphics module).
If all goes well, I would then like to attempt to add support for a new domain specific language.
Would I need to learn C for any of these tasks? If so, which standard? C89, C99, C11 or something else?
How about Lua, Flex and Yacc/Bison? Assembly language?
Beta Was this translation helpful? Give feedback.
All reactions