News for hackers. Stuff that matters.
Re:Super Tiny Compiler by unwind on Thursday March 31, 2016 @05:11AM (#11395895)
I get your point and agree about assembly, but I also think most people would agree that C is a lower level of abstraction than LISP.

One reason to "stop" at C might be that assembly itself tends to be a bit verbose, so not very suitable when aiming for shortness of code as a major feature. Generating assembly would perhaps obscure the things being taught with a bunch of details that are of course interesting, but sort of beside the point. Just guessing, I'm not the original author of course.

Re:Super Tiny Compiler by dcw303 on Thursday March 31, 2016 @05:31AM (#11395949)
I take your point as well.

I guess I'm coming at this as a novice with a recent interest in compilers. I was working through a tutorial series for writing a compiler in Go, but it got frustrating when I realized the author's example language wasn't going to output anything lower than C.

I've since found a series that does show how to output to assembly (68000 no less) and I'm finding it much more rewarding.

Re:Super Tiny Compiler by majewsky on Thursday March 31, 2016 @06:17AM (#11396086)
I see the educational value in building a compiler to C if you want to introduce people to parsing, AST transformations, visitor pattern etc.

But a lot of interesting parts about a compiler are lost when you compile to a high-level language instead of machine code: code selection (to a large extent), register allocation, operation scheduling.

Doing a compiler backend right is much more challenging than doing a compiler frontend right, which is why tutorials usually skip it, and also why people are so grateful for LLVM, which gives a common compiler backend for about every platform imaginable.

Re:Super Tiny Compiler by chrisseaton on Thursday March 31, 2016 @06:53AM (#11396199)
Right - all these compiler tutorials, and many compiler textbooks are about the front-end only. The back-end is where all the fun and magic is.
Re:Super Tiny Compiler by doom2 on Thursday March 31, 2016 @11:04AM (#11397685)
Do you mind linking to the other resource you're using? The one outputting to assembly.
Re:Super Tiny Compiler by marvy on Thursday March 31, 2016 @12:17PM (#11398273)
Probably the one mentioned here:

http://prog21.dadgum.com/30.html

Re:Super Tiny Compiler by dcw303 on Thursday March 31, 2016 @11:03PM (#11402264)
Yep, that's the one!
Re:Super Tiny Compiler by nickpsecurity on Friday April 01, 2016 @12:35AM (#11402652)
Depends on if your using a LISP processor or x86. And a LISP processor is basically eval on a few primitives. Really low-level and simple.