News for hackers. Stuff that matters.
Re:Writing Your Own Programming Language by gshubert17 on Thursday November 10, 2016 @12:15PM (#12922194)
TECS (The Elements of Computing Systems) devotes 2 chapters out of 12 to writing a compiler for a Java-like language. Lexical analysis is more complex, with operators and identifiers and comments in addition to parentheses, numbers, and the letter 's'.

TECS provides a skeleton of a recursive descent parser, with about a dozen different methods to write. The Java-like language has many different kinds of expressions and statements, and this is reflected in the complexity of the parser.

At first the output is an XML tree. Code generation gets an entire chapter. Some of the chapters are straightforward, less than 6 hours of work. But the harder chapters have taken me around 15 hours each. YMMV, but this gives one some idea of the differences between functional languages and procedural languages.

Re:Writing Your Own Programming Language by protomikron on Thursday November 10, 2016 @01:03PM (#12922656)
TECS is a wonderful book! I think it was one of the most enjoyable books about CS I have ever read.