Concise: A full compiler for ChocoPy be implemented in about 12 weeks by undergraduate students of computer science. This can be a hugely rewarding exercise for students.
Written in itself, and thus self-compiling? IMHO that's one of the biggest advantages of using C/C-subset compilers, that it's relatively easy to do so, and I think writing a self-compiling compiler is especially important in a course because it really drives home the point that a compiler is just another piece of software.
> because it really drives home the point that a compiler is just another piece of software
This fact is already conveyed conveniently by writing the compiler itself in any language. The important this is the transformation from structure to structure and the recursive nature of grammar rules.
Having wrote an assembler, a linker and for another project a sort of compiler with Flex & Bison (FsLexYacc actually) I think emphasis should be on how close writing a parser and compiler are (because one task include the other ). Thus, understanding the main ideas in compilers can be reused for real tasks such as data parser, where is can solve problems more eloquently than ad hoc coding.
Agreed, however there are plenty of languages one can use for bootstraping, I don't see it as advantage from C/C++, rather how many lectures are lazy in how they build their curriculum.
This one here is a great alternative approach, specially to dispel the idea C or C++ are required to be anywhere in a compiler stack.
The thing with actually self-compiling is that you need language features such as file management, which are not trivial and would take time that we don't have in a compiler course to cover. There is already so much to be said about compilation, and generally the course must also cover assembly language and hardware architecture at least.
The course website from last semester (when I took this course!) has just about everything except for lecture recordings and starter code for the project, and it’s still up: http://www-inst.eecs.berkeley.edu/~cs164/sp19/
Various flavors of a course based on "An Incremental Approach to Compiler Construction" [1] have most or all materials free online, some with excellent notes. Taught at UCSD, Northeastern, Swarthmore College:
This looks cool, and if you click the "Compile to RISC-V" button you get to a page where a lot of the assembly code has meaningful comments explaining what each instruction does. I wish we had that in every compiler...
As for GC, if I read the code correctly it doesn't do any and simply aborts on out of memory. Fair for a first compiler course.
> where a lot of the assembly code has meaningful comments explaining what each instruction does
Cutter (which is based on Radare2, basically a GUI for r2) can do that under the "Disassembly" tab! It works with executables and source code. You have to configure it to show the additional information though. It is such a neat tool!
What! The best ever python name has been taken for complier course. My both sons love chochopy and they will be devasted to know that chochopy isn't a sprite based programming language for kids.
[+] [-] userbinator|6 years ago|reply
Written in itself, and thus self-compiling? IMHO that's one of the biggest advantages of using C/C-subset compilers, that it's relatively easy to do so, and I think writing a self-compiling compiler is especially important in a course because it really drives home the point that a compiler is just another piece of software.
[+] [-] tasogare|6 years ago|reply
This fact is already conveyed conveniently by writing the compiler itself in any language. The important this is the transformation from structure to structure and the recursive nature of grammar rules.
Having wrote an assembler, a linker and for another project a sort of compiler with Flex & Bison (FsLexYacc actually) I think emphasis should be on how close writing a parser and compiler are (because one task include the other ). Thus, understanding the main ideas in compilers can be reused for real tasks such as data parser, where is can solve problems more eloquently than ad hoc coding.
[+] [-] pjmlp|6 years ago|reply
This one here is a great alternative approach, specially to dispel the idea C or C++ are required to be anywhere in a compiler stack.
[+] [-] p4bl0|6 years ago|reply
The thing with actually self-compiling is that you need language features such as file management, which are not trivial and would take time that we don't have in a compiler course to cover. There is already so much to be said about compilation, and generally the course must also cover assembly language and hardware architecture at least.
[+] [-] xurias|6 years ago|reply
[+] [-] kark|6 years ago|reply
[+] [-] hexhu|6 years ago|reply
[+] [-] unknown|6 years ago|reply
[deleted]
[+] [-] mixmastamyk|6 years ago|reply
[+] [-] bhrgunatha|6 years ago|reply
Keith Schwartz Stanford Compiler course CS143 http://www.keithschwarz.com/cs143/
Stanford's Engineering Compiler course on Lagunita https://lagunita.stanford.edu/courses/Engineering/Compilers/...
Matt Might's courses are self educational blueprints http://matt.might.net/teaching/compilers/
Book Introduction to Compilers and Language Design https://www3.nd.edu/~dthain/compilerbook/
I'm not a fan of uncurated link dumps, however: Awesome compilers link aggregation on Github https://github.com/aalhour/awesome-compilers
[+] [-] jpolitz|6 years ago|reply
https://ucsd-cse131-s18.github.io https://course.ccs.neu.edu/cs4410/lec_let-and-stack_notes.ht... https://ucsd-progsys.github.io/131-web/lectures/05-cobra.htm...
(I designed the original version, though it's improved a lot in the past few years)
[1] http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf
[+] [-] tutanchamun|6 years ago|reply
[+] [-] tom_mellior|6 years ago|reply
As for GC, if I read the code correctly it doesn't do any and simply aborts on out of memory. Fair for a first compiler course.
[+] [-] johnisgood|6 years ago|reply
Cutter (which is based on Radare2, basically a GUI for r2) can do that under the "Disassembly" tab! It works with executables and source code. You have to configure it to show the additional information though. It is such a neat tool!
[+] [-] JaDogg|6 years ago|reply
[+] [-] eterps|6 years ago|reply
[+] [-] unknown|6 years ago|reply
[deleted]
[+] [-] xhgdvjky|6 years ago|reply
[+] [-] xhgdvjky|6 years ago|reply
[+] [-] shantanu77|6 years ago|reply
[+] [-] popnroll|6 years ago|reply