powershellantlr4error-logging

ANTLR4 no error messages while converting my grammar


the last few days/weeks I wrote ANTLR4 grammar and used it in my Javascript-React project. While using the javascript runtime ( see here ), my console (powershell) always gave me an error message when my grammar was false or something was missing.

Now I'm out of town for a few weeks and had to install ANTLR4 + runtime on my laptop ( scroll down to WINDOWS for the tutorial I used ). This CLASSPATH stuff didn't worked for me, so I ignored it and .bat script didn't worked for me either, like when I installed it for the first time.

My file structure looks like this:

enter image description here

When I go into my powershell and switch to the right folder and hit

.\antlr-4.11.1-complete.jar -Dlanguage=JavaScript .\FunktionLexer.g4

everything works fine and I have my token for the parser. This is probably exact the same installation I had before going out of town.

But when I use wrong grammar and hit the command just nothing happens. Like nothing, no output on my command line what could be wrong. I tryed to add parameter like -Xlog, which gives me a log until the grammar crashes, but it doesn't really tell me where it crashed.

Thanks in advance!


Solution

  • Given the grammar (without lexer rules):

    grammar FunktionLexer;
    
    parse
     : .*? EOF
     ;
    

    I can generate a lexer and parser just fine by running:

    java -jar antlr-4.11.1-complete.jar -Dlanguage=JavaScript FunktionLexer.g4
    

    You might want to edit your question and clearly indicate how someone can reproduce what you describe.