3 ms·
Why not go for the full C language. C was made to make compilers easy to build. Also it might expose/help to see difficulties in the chosen approach.
by andi999 5y ago
Why not go for the full C language. C was made to make compilers easy to build. Also it might expose/help to see difficulties in the chosen approach.
- deleted 5y ago[deleted]
- ash_gti 5y agoThey went with a subset of C, its enough to write a working executable. Generally for a introduction tutorial to something as complex as writing a compiler a subset like what they presented in the article is enough to show how all the pieces work together to produce a working compiler.
- mikepurvis 5y agoYup, for the purposes of a demo like this, a simplified top-to-bottom "vertical slice" is of far more value than total feature coverage.
- deleted 5y ago[deleted]
- reikonomusha 5y agoA conforming ISO C compiler seems extremely difficulty to build and I don’t think ease of writing a compiler is a part of the design these days.
- pjmlp 5y agoUnless you are talking about something like "A Retargetable C Compiler: Design and Implementation", it is definitly not easy. https://www.amazon.com/Retargetable-Compiler-Design-Implementation/dp/0805316701 https://www.amazon.com/Retargetable-Compiler-Design-Implemen... During the early 80's, the best home computers could get was Small-C. https://en.wikipedia.org/wiki/Small-C https://en.wikipedia.org/wiki/Small-C
- randomifcpfan 5y agoSmall-C was the best one with open source, but there were many others. This one was my favorite: https://www.bdsoft.com/resources/bdsc.html https://www.bdsoft.com/resources/bdsc.html
- pjmlp 5y agoWhat I got back in the day came in book form, it was also another flavour. "A book on C" https://link.springer.com/book/10.1007/978-1-349-10233-4 https://link.springer.com/book/10.1007/978-1-349-10233-4 It uses a K&R C subset with bytecodes and a bytecode-> machine language translation. I just never bothered to type it in though.