Pages

Monday, April 23, 2012

ANTLR important language syntaxes

* Rules begins with lower case

* Token types begins with upper case letter

* Lexer rules are given in upper case.

* x | y | z - match any alternative: x or y or z

* x? - x is optional

* x* - x can present zero or more times

* x+ - x can present one or more times

* Lexer rules are always tokens and should be given in upper case. Methods related to lexer rules are prefixed with 'm'.

Reference: The defenitive antlr reference - building domain specific languages

1 comment:

  1. Its really interesting
    Eclipse has its own plugin with it;

    ReplyDelete