VisualLangLab Grammars Now Even More Intuitive
Earlier versions of VisualLangLab required the user to specify an alphanumeric name for all tokens. This made it difficult to understand rules using tokens without intuitive names. A good example is the rule infixOp from a Java grammar in Figure-1 below.
Figure-1. Rule with non-intuitive token names
While PLUS and MINUS have good mnemonic value, many users will not understand TILDE and BANG. And the contrived names PLUS2 and MINUS2 will leave most users completely clueless. The AST does show the actual pattern, but this is not helpful in complex rules where the token-to-pattern association is not so obvious.
Starting version 10.37, tokens may use the pattern itself, enclosed in quote marks, as their name. Figure-2 below shows the same rule but with tokens using the new naming convention.
Figure-2. Rule with new token-naming convention
Obviously, this makes the tokens far more understandable.
There are more examples in the complete grammar which you can read about in A Java7 Grammar for VisualLangLab. But if you are new to VisualLangLab, you may want to review Grammar Without Tears first. The grammar file itself is available as the file jls-se7-40.txt (which you should rename to jls-se7-40.vll before use).
Another article that uses VisualLangLab to work several examples from the book The Definitive ANTLR Reference can be read at A Quick Tour, and if you are interested in Scala parser combinators, then Scala Rapid Prototyping is a must read.