Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Indentation instead of brackets for Antlr4

I'm currently attending the course "Compilers Construction" and I'm developing a simplified Java grammar in Antlr 4. The part involving Java grammar works just fine, except that it is slightly different from the original Java.

I'm told I should no use brackets and instead use indentation. I have tried a few examples from the internet, only examples for Antlr 3 which won't work in Antlr 4.

Can anyone help me with this indentation issue, or provide me the Python grammar for Antlr 4?

like image 622
Leonhart Squall Avatar asked Oct 04 '22 10:10

Leonhart Squall


1 Answers

What about official GitHub ANTLR4 grammar repository? You can find many common language grammars. There is even a python3 directory containing Python3.g4.

This should help you out.

like image 183
petrbel Avatar answered Oct 07 '22 19:10

petrbel