Re:Kernel 101 – Let’s write a Kernel
by mbillie1 on Monday April 14, 2014 @04:56PM
(#7588882)
Very cool. I personally (as a developer without a CS background) find these sorts of posts wonderfully interesting, even if this kernel, as pointed out in this thread, lacks a lot of what a normal kernel does. I'd love to see one of these for a compiler!
[ Parent
| on HN ]
I highly recommend http://www.hokstad.com/compiler/ ; it talks about writing a compiler in a way that makes sense to me - writing it the way you write any other program, rather than throwing you straight in with lexers and parsers and never justifying why we need to do things this way.
Glad you like it... I'm hoping to push out the next part later this week, and I've got a few more drafts queued up that "just" needs some proofreading.
Working on getting it to the point where it can fully compile itself now, and hope to get there over the couple of months.
Re:Kernel 101 – Let’s write a Kernel
by steveklabnik on Tuesday April 15, 2014 @11:57AM
(#7592512)
I've been reading this series with interest for years. Thank you for writing it.
Re:Kernel 101 – Let’s write a Kernel
by bronxbomber92 on Monday April 14, 2014 @05:09PM
(#7588970)
Writing an expression parser is probably the compiler "equivalent": http://www.strchr.com/expression_evaluator
More like an expression parser that doesn't handle precedence or unary operators
FYI, I recommend using the precedence climbing algorithm if you do need to do expression parsing: http://eli.thegreenplace.net/2012/08/02/parsing-expressions-...
It fits very well into a full recursive descent parser and is much more efficient and flexible than hardcoding in productions for handling the operators (and you can dynamically add new ones easily).