Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ANTLR JavaScript Target

I have been using ANTLR to generate a parser + tree grammar for a mark up language with Java target which works fine. Now I am trying to get the target in JavaScript to use it in my web browser.

However, I have not been able to locate any good documentation on how to go about doing this. I am using eclipse with ANTLR IDE, and when i specify the language as JavaScript, I get the following errors.

Multiple markers at this line

  • (10): internal error: group JavaScript does not satisfy interface ANTLRCore: mismatched arguments on these templates [treeParser(grammar, name, scopes, tokens, tokenNames, globalAction, rules, numRules, bitsets, labelType, ASTLabelType, superClass, members, filterMode)]

  • (10): internal error: java.util.NoSuchElementException: no such attribute: filterMode in template context [treeParser]

If anyone could help me out with this or point me to some material which I could read about the JavaScript target with ANTLR, it would be great.

Thanks

like image 598
Gunner4Life Avatar asked Mar 29 '10 18:03

Gunner4Life


1 Answers

There is a new JS Lang target for ANTLR4 that was posted to GitHub almost 3 months ago:

antlr/antlr4-javascript

It's not integrated into an official release yet, but you can probably just throw it into the latest ANTLR4 codebase and recompile ANTLR yourself.

like image 115
jhyry Avatar answered Sep 30 '22 15:09

jhyry