News for hackers. Stuff that matters.
Re:How Difficult is it to Write a Compiler? by Goladus on Tuesday December 16, 2008 @10:34AM (#399550)
Parsing is complicated, as the author admits. It is also a problem well-understood by the field in general, though, and once it is learned is not a major obstacle. Setting up a parser, though, can involve a lot of easy but tedious work, depending on the language.

Following a language specification requires precise attention to detail, and understanding of the whole process helps a lot.

For a sufficiently complex language, writing code to manipulate the AST requires ability to hold a lot of data in your head at one time, or some really good visualizing tools.

Code-generation from AST can easily require a lot of effort, even when it is not especially difficult (and it can be difficult).

Optimization is difficult.

Error reporting is difficult.

Re:How Difficult is it to Write a Compiler? by kragen on Tuesday December 16, 2008 @01:12PM (#399767)
Actually, in my experience, PEGs make parsing not complicated. What kind of visualization tools have you found helpful in manipulating the AST? So far I've found equational reasoning (in my head or on paper) much more helpful than visualization in writing code to manipulate ASTs. And code generation from ASTs does not require a lot of effort when it is not especially difficult; it's really just a tree traversal or two. (As you point out, with optimization it can become arbitrarily difficult.)