问题
What is the status of the JavaScript target in ANTLR 3.4 or 3.5? I have been looking online for an answer to this question but so far I have found nothing. I know that it was broken in v3.2 and then it was fixed in v3.3, but it's not listed in the ANTLR 3.4 release notes as a target that is consistent with ANTLR 3.4.
I have a project in which I need to convert the Java target ANTLR grammar which I had previously written to JavaScript and I want to make sure that the JavaScript target is supported by ANTLR 3.4 or 3.5 before I proceed.
回答1:
ANTLR 3.1 and 3.2 had some bugs w.r.t. generating JavaScript code1, but you should be okay with version 3.3.
You can find the JavaScript runtime here: http://www.antlr3.org/download/antlr-javascript-runtime-3.1.zip
A small demo of how to use ANTLR + JS can be found in this Q&A: ANTLR PCRE Grammar to JS Target
1 http://www.antlr.org/wiki/display/ANTLR3/ANTLR3JavaScriptTarget
来源:https://stackoverflow.com/questions/19841084/status-of-javascript-in-antlr-3-4-or-3-5