5 ms·
Compiler design depends a lot on the language being compiled though, this would be a typical design for a C-style language. When doing Forth-style languages fo
by andreasgonewild 9y ago
Compiler design depends a lot on the language being compiled though, this would be a typical design for a C-style language.
When doing Forth-style languages for example; I've found that it's not very helpful to parse to trees, since I can't tell the structure of function calls before seeing the actual running stack anyway. Which in turn affects the compiler, since all it has to work with is a sequential stream of tokens.
And not all languages are stand-alone, or compile all the way down to machine code. Compiling to byte-code for running immediately, with the backup of a runtime library; is an attractive option for more specialized languages; and this means that it's possible to carry more information straight over from compilation to runtime.
I've been working on a scripting language that raised some of these questions lately:
https://github.com/andreas-gone-wild/snackis/blob/master/snabel.md https://github.com/andreas-gone-wild/snackis/blob/master/sna...