7 ms·
ChocoPy: A Programming Language for Compilers Courses
- shantanu77 7y agoWhat! 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.
- popnroll 7y agoWhat? I don't know what "chochopy" is, but this project is called Chocopy.
- shard 7y agoChoco-pie is a delicious Korean snack made with chocolate and marshmallows: http://www.trifood.com/chocopie.asp http://www.trifood.com/chocopie.asp You can find it at your local Korean market, and in Costco if you are in the SF Bay Area
- deleted 7y ago[deleted]
- xhgdvjky 7y agoyeah but is it COOL
- xhgdvjky 7y agosince it's getting down voted .. https://en.wikipedia.org/wiki/Cool_(programming_language) https://en.wikipedia.org/wiki/Cool_(programming_language)
- jperry 7y agoNot knowing anything about this, I thought this would be about C# :) https://en.wikipedia.org/wiki/C_Sharp_(programming_language)#History https://en.wikipedia.org/wiki/C_Sharp_(programming_language)...
- userbinator 7y agoConcise: 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.
- pjmlp 7y agoAgreed, 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.
- userbinator 7y agospecially to dispel the idea C or C++ are required to be anywhere in a compiler stack. According to the sibling comment, the compiler is written in Java. The Java compiler is written in Java and runs in a JVM which is itself written in C/C++, and we all know how C compilers were created...
- pjmlp 7y agoAlmost there, then a wrong turn. Java has multiple implementations, some of them happen to be fully done in Java, like JikesRVM, MaximeVM and Graal. Naturally you might say, that you only care about OpenJDK, which incidentally now has the Project Metropolis with the long term roadmap to use Graal and SubstrateVM to replace those C/C++ parts. As for C, many probably aren't aware that BCPL was originally designed to bootstrap CPL, a memory safe systems programming language based on Algol, which due to mismanagement never took off, while BCPL bare bones as it was, took a life of its own. Also well into the mid 90's there were quite a few OSes where C was still far from doing its mark, thus it was not even an idea to use it when bootstrapping a compiler.
- mixmastamyk 7y agoInteresting, are there any other free, modern compiler courses?
- bhrgunatha 7y agoUniversity Of Washington CSEP501: Compiler Construction http://courses.cs.washington.edu/courses/csep501/ http://courses.cs.washington.edu/courses/csep501/ Keith Schwartz Stanford Compiler course CS143 http://www.keithschwarz.com/cs143/ http://www.keithschwarz.com/cs143/ Stanford's Engineering Compiler course on Lagunita https://lagunita.stanford.edu/courses/Engineering/Compilers/Fall2014/about https://lagunita.stanford.edu/courses/Engineering/Compilers/... Matt Might's courses are self educational blueprints http://matt.might.net/teaching/compilers/ http://matt.might.net/teaching/compilers/ Book Introduction to Compilers and Language Design https://www3.nd.edu/~dthain/compilerbook/ 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 https://github.com/aalhour/awesome-compilers
- vymague 7y agoI really wish we have a compiler analog of "Operating Systems: Three Easy Pieces".
- pjmlp 7y agoSomething like "Compiler Construction in Oberon", "lets build a compiler", "Turbo Pascal Internals"? https://inf.ethz.ch/personal/wirth/CompilerConstruction/index.html https://inf.ethz.ch/personal/wirth/CompilerConstruction/inde... https://compilers.iecc.com/crenshaw/ https://compilers.iecc.com/crenshaw/ http://turbopascal.org/ http://turbopascal.org/
- jpolitz 7y agoVarious 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: https://ucsd-cse131-s18.github.io https://ucsd-cse131-s18.github.io https://course.ccs.neu.edu/cs4410/lec_let-and-stack_notes.html https://course.ccs.neu.edu/cs4410/lec_let-and-stack_notes.ht... https://ucsd-progsys.github.io/131-web/lectures/05-cobra.html 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 http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf
- eterps 7y agoA ChocoNim could also be an interesting choice, closer to the metal and opens up potential for self compilation.
- xurias 7y agoA bit disappointing that the course isn't openly available in any way. It sounds really interesting.
- kark 7y agoThe 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/ http://www-inst.eecs.berkeley.edu/~cs164/sp19/
- deleted 7y ago[deleted]
- hexhu 7y agoThis fall: https://sites.google.com/site/cs164fall2019/ https://sites.google.com/site/cs164fall2019/ Last fall: https://sites.google.com/site/cs164fall2018/ https://sites.google.com/site/cs164fall2018/
- tom_mellior 7y agoThis 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.
- johnisgood 7y ago> 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!
- tom_mellior 7y agoSorry, I was probably unclear. I imagine Cutter just tells you what each opcode does, no? gcc.godbolt.org does that too, with links to the ISA docs. But here I mean that in the ChocoPy code you get explanations of what instructions do in the context of the program's semantics, i.e., how they relate to a higher-level view of what's going on. An example: .globl $print $print: # Function print lw a0, 0(sp) # Load arg beq a0, zero, print_6 # None is an illegal argument lw t0, 0(a0) # Get type tag of arg li t1, 1 # Load type tag of `int` beq t0, t1, print_7 # Go to print(int) li t1, 3 # Load type tag of `str` beq t0, t1, print_8 # Go to print(str) li t1, 2 # Load type tag of `bool` beq t0, t1, print_9 # Go to print(bool) print_6: # Invalid argument li a0, 1 # Exit code for: Invalid argument la a1, const_4 # Load error message as str addi a1, a1, @.__str__ # Load address of attribute __str__ j abort # Abort Note that the different occurrences of lw and li explain the meanings of the magic constants in the code. This would be pretty hard to do from disassembly alone.
- JaDogg 7y agoMake the course content available for public please.