Getting following error: [ERROR] main.c:144: (null): One of -a, -c, -E or -S must be specified
-c, -E and -S are working fine. Couldn't figure out from code what -a does.
41–50 of 128 posts
Getting following error: [ERROR] main.c:144: (null): One of -a, -c, -E or -S must be specified
-c, -E and -S are working fine. Couldn't figure out from code what -a does.
> I suspect that he [Dennis Ritchie] invented a syntax, wrote code for it, which turned out to be more complicated than he had expected. And that was eventually standardized by the ANSI committee. It's hard to implement a standardized language because you have to get everything right. It's rather easy to write your own toy language. Love those lines
For anyone interested in compiler writing and looking for a good resource to start, probably one of the best is the "Dragon Book": http://www.amazon.com/Compilers-Principles-Techniques-Tools-... I highly recommend it, but it's heavy stuff. There are probably simpler guides out there that just cover the basics.
Please stop recommending the Dragon Book already. It is not just heavy, it is mostly outdated and irrelevant.
That said, I typically recommend compilers get written in an ML or LISP given it's so much easier to do in those languages. Ocaml and Racket are my main recommendations for modern work. One can also use techniques for deriving imperative code from functional programs if one wants to re-implement that compiler in specific imperative language on a machine. The constructs are even straight-forward enough for macro assembly for those that want to understand it down to bare metal.
I was a little surprised that the author was able to manage both C11 and the preprocessor in that time. The preprocessor is hard. But there was existing code from a previous version of it, which makes sense. Still, a fantastic achievement! Congrats to the author!
Long ago UNIX had compiler writing tools like yacc and lex. I wonder if they are useful for exercises like this.
They might, although no production quality C or C++ compiler uses anything other than a hand-rolled recursive descent parser, afaik. The lex, parse and AST directories in Clangs source tree are ~100,000 LOC combined, and all hand-written.
> I suspect that he [Dennis Ritchie] invented a syntax, wrote code for it, which turned out to be more complicated than he had expected. And that was eventually standardized by the ANSI committee. It's hard to implement a standardized language because you have to get everything right. It's rather easy to write your own toy language. Love those lines
It's actually a clone of BCPL, which invented keywords & "programmer in charge philosophy." They ported it to PDP's with a few changes for UNIX. Standards came later. Specific details every step of the way are here: http://pastebin.com/UAQaWuWG
Long ago UNIX had compiler writing tools like yacc and lex. I wonder if they are useful for exercises like this.
FWIW, if I had to do this again today I would certainly go for hand-written recursive descent. lex/yacc charm you in but eventually prove to be much more difficult to tweak and reason about.
Long ago UNIX had compiler writing tools like yacc and lex. I wonder if they are useful for exercises like this.
Earlier quoted context omitted.
It's actually a clone of BCPL, which invented keywords & "programmer in charge philosophy." They ported it to PDP's with a few changes for UNIX. Standards came later. Specific details every step of the way are here: http://pastebin.com/UAQaWuWG
That vimeo talk was rich. ps: https://vimeo.com/132192250