For those writing language processors in Java, I highly recommend having a look at JastAdd [1]. It's a great framework for implementing semantic analysis using attribute grammars [2]. The tool automatically generates Java classes to represent ASTs, based on a high-level description (a CFG grammar) of the desired AST shape. You can use any Java-based parser as long as the AST it produces is constructed from those classes. That's only the starting point; the real power is in the excellent support for expressing attribute computation. It uses a high-level, lazy equational formalism extended by the programmer with custom logic, which is then turned into automatically-generated Java code. Compilers/interpreters written in JastAdd tend to be very well structured and easy to maintain. It's one of my all-time favourite libraries, actively maintained, and very well documented.
[1] http://jastadd.org/web/documentation/concept-overview.php
And for Scala, there's Kiama https://bitbucket.org/inkytonik/kiama
To address this problem, I use Zephyr ASDL to describe the abstract syntax of a language (which CPython also uses!)
It's a little DSL that lets you write an ML-style algebraic data type, and generates a bunch of code for you. In CPython, you go from ~100 lines ASDL schema to ~10,000 lines of C! It underlies the 'ast' module in the stdlib.
Why is Zephyr ASDL? http://www.oilshell.org/blog/2016/12/11.html
It eliminates the need for a lot of boilerplate he pointed out:
https://github.com/praeclarum/CLanguage/tree/master/CLanguag...