tinyc: lexer+parser+code generator+VM in 291 lines of C code by Marc Feeley
iro.umontreal.ca/~felipe/IFT2030-Automne2002/...Posted Feb 20, 2012, 7:05 PM UTC
4310
Posted Feb 20, 2012, 7:05 PM UTC
The code compiles fine, but whenever I execute it, it gives me a "syntax error" at best. I have tried each of the examples given in the comment section, and they all result in the same error. Any ideas?
works fine for me when compiled with clang (compiles w/o warnings). llvm-gcc is clean as well. I don't have any other C compilers available right now.
What OS are you running this on?
Try this: echo a=1; | a.out
If you are on Windows, it is probably the quotes that are giving you problems.
I'm throwing a penalty flag here.
These are especially egregious since LOC was expanded by uselessly prolific statements.
Expands to 380 lines of C (given by
cloc) after run throughindent -krand cuddling open braces.Marc Feeley is the author of the high-performance Gambit Scheme compiler. The indentation style is likely a crossover from Lisp to C. You can also see die-hard Python programmers writing C code in a similar manner.
Marc Feeley along with Fabrice Bellard are on high on the log(bad_ass) scale.
I must he has a dedication for Scheme and Gambit in particular. I've had a class with him and it's like he lives on Scheme. Good teacher also, hard class but you learn a lot (Programming Language Concepts, part of second year of Computer Science Bachelor, second part is functional programming using Scheme).
Especially a shame as 380 lines is still impressive
380 lines of code is pretty impressive considering the task & feature set. It clearly wasn't written with "minimize SLOC" as the main priority, since it could have easily been made smaller simply by dropping the functions into a switch or something dumb like that.
That said, I consider 291 an unfairly calculated line count, and I'll stand by 380.
it's a shame that this subreddit seems to be promoting bad coding behavior...