Re:One-pass Compiler
by tom_mellior on Sunday May 24, 2020 @02:20AM
(#23289580)
This is nice. The -debug flag is a cool feature. But if you first build a representation of the whole program in memory, then traverse that representation to generate code, it's not really single-pass.
Sorry my comment was wrong, I should have said "not a single-pass", that's why I mentiond the trivial internal representation.
Too late to edit now!
Re:One-pass Compiler
by userbinator on Saturday May 23, 2020 @10:31PM
(#23288602)
Because otherwise your return value is limited to an 8bit number
Only on Linux; Windows lets you use the full 32 bits.
https://github.com/skx/math-compiler
The real difference between the compiler in the example, and mine, is that I handle floating-point operations and also explicitly use printf to show the output. (Because otherwise your return value is limited to an 8bit number.)