http://www.timphilipwilliams.com/posts/2014-05-22-the-essenc...
http://www.timphilipwilliams.com/posts/2014-05-22-the-essenc...
As Java was just released by the time my class got to do the same assignment, we ended up using Java with JavaCC and JJTree.
While not as easy as Lisp, ML or Prolog, it was still much easier than the Jurassic yacc/lex that still prevails in some circles.
Reminds me of this quote "Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp."
Source: https://en.m.wikipedia.org/wiki/Greenspun%27s_tenth_rule
Interestingly, most mature industrial languages (e.g. Java, GCC, clang) use hand-coded recursive descent parsers. And of course such parsers can be implemented very easily from first principles using parser combinators in FP.
I've used both JavaCC and Antlr in the past for small DSLs, both are very good tools, when working with Java.
Pattern matching and FP/LP based algorithms are quite convenient, versus doing it in an imperative approach.
Hand coded parsers win on the error reporting front.
Everyone who is into compilers and parsing should try recursive descent at least once.
From my experience most people don't use parser generator tools due to lack of knowledge that they even exist.
The first one isn't such a big deal for most programming languages, the second one is. Throw in better error handling and tricks like sub-file incremental and/or heuristical compilation (for IDEs), and the generators don't make much sense anymore.
I don't think you can make such a sweeping generalisation. Both JavaCC and Antlr have saved me a lot of time when doing DSLs in the past and both are well documented and easy to use. It would have been much more work for me to write the parsers by hand in Java. Both could also generate my own hand-rolled AST easily and so I do not see why integration would be a problem for most projects. I agree that generators do not scale to large compilers or projects with special needs, but that is not most projects.
Not so much when prototyping, when it isn't even clear if the language is going to get any users beyond the design team.
Compilers often use graphs as intermediate representation, and functional languages often are not a good fit for dealing with them.
That said, functional languages can and do work with graphs when needed, but yes it is much more awkward than trees.
Why is that?