antlr

Antlr4 C++ target

岁酱吖の 提交于 2019-12-10 13:33:55
问题 We're starting a project where we will need to parse python source files in a C++ application. I've used Antlr2 a while back to generate a few compilers, but this is the first time I'm using Antlr4. It looks like the c++ antlr4 target is fairly active at https://github.com/antlr/antlr4-cpp So, my question is basically what is the status of the Antlr4 C++ target, is it ready to start being used? To use the C++ target, what just grab the Antlr4 source, and copy the Antlr4-cpp into this tree and

ANTLR “Cannot launch the debugger. Time-out waiting to connect to the remote parser.”

爷,独闯天下 提交于 2019-12-10 13:22:13
问题 One of my ANTLR grammars running in AntlrWorks throws: “Cannot launch the debugger. Time-out waiting to connect to the remote parser.” In the past this message usually goes away but this one is persistent. On searching the ANTLR lists (e.g. http://www.antlr.org/pipermail/antlr-interest/2009-June/034659.html) there are hints that the error message is nothing to do with what it seems but could be a grammar error. Has anyone got tips as to how to "reboot" or find the bugs in this situation? 回答1:

writing parser of a simple language

空扰寡人 提交于 2019-12-10 12:06:52
问题 I'm trying to design a simple language is similar to lips, schema. I have written its lexer(tokenizer). I can seperate into operators, identifiers etc. But I try now writing parser. For this, just one example is enough for me. Can someone give me an example in java code just for the example? Besides, everyone mentions of usage antlr. Can someone who attempts to use antlr show an example using my example in this question? – EXP -> EXPI | EXPB – EXPI -> (+ EXPI EXPI) | (- EXPI EXPI) | (* EXPI

Can a ANTLR grammar file be modified to be used by PLY?

北战南征 提交于 2019-12-10 11:44:58
问题 I want to make a python program that uses PLY to parse Javascript files, I din't found any sources of parsers that implement the ECMAScript, Javascript rules that use PLY. The only thing I found was some ANTLR grammar files to parse javascript and ecmascript: http://www.antlr.org/grammar/1153976512034/ecmascriptA3.g http://www.antlr.org/grammar/1206736738015/JavaScript.g Can ANTLR grammar files be adapted to be used as PLY rules, if yes, how can be done in a semi-automatic way, do I need to

ANTLR grammar for scheme R5RS

跟風遠走 提交于 2019-12-10 11:25:17
问题 I'm beginner in ANTLR and I'm learning it by an example. I use C as my target language. The example is a Scheme R5RS grammar file taken from this question, with a little modification(rename the grammar name and add some options with the grammar specification untouched). antlr generated the lexer and parser, and I compile it with a test main() in which I just do some initialization and simply call the parser. When runing the test program with a piece of scheme code, the parser detect some

ANTLR : rules with arguments?

烈酒焚心 提交于 2019-12-10 11:16:24
问题 I am new to ANTLR. I started exploring ANTLR tutorials. I have seen example where return type have been defined for perticular rule(see below example ). Can I pass argument to rule as well ? I just have throught in my mind, i wanted to change the behavior of rule at a pertucular state based on argument provided to it . please help me if it passible in ANTLR or is it a good idea to do that ? atom returns [int value] : INT { $value = Integer.parseInt($INT.text); } | ID // variable reference {

How can I import an ANTLR lexer grammar into another grammar using Gradle 2.10?

为君一笑 提交于 2019-12-10 11:14:07
问题 I've been learning about ANTLR 4 with Terence Parr's The Definitive ANTLR 4 Reference , which I've been following so far using Gradle 2.10 and its built-in ANTLR plugin. However I'm having some trouble getting some code which I adapted from Chapter 4, pp. 38-41 to work properly with my Gradle build script. (The reason I'm using Gradle, rather than ANTLR directly, is because I want to eventually integrate ANTLR into a Java web application which I'm making for my dissertation, and I'd strongly

Using antlr to parse lua IF statements in specific functions

独自空忆成欢 提交于 2019-12-10 11:05:17
问题 I generated a Lua Parser using the Lua.g grammar with antlr in java. My lua code which i wish to parse basically looks like this function uniqueid_some_event (e) if (e:HasString("string1")) then -- do something end if (e:HasString("string2")) then -- do something end end I have hundred of these events in different files for specific actor bindings. Now i want to parse these files and gather for each what conditions are checked - in the above case - i want to extract "string1" and "string2" as

How to convert MySQL yacc grammar to antlr LL(1)?

▼魔方 西西 提交于 2019-12-10 11:03:19
问题 I am constructing a MySQL grammar validator with ANTLR. I started with the sql_yacc.yy from the MySQL source code, but I have some difficulties converting the following grammar. I tried many times, but it doesn't work. Can anyone help me? expr : expr or expr | expr XOR expr | expr and expr | NOT_SYM expr | bool_pri IS TRUE_SYM | bool_pri IS not TRUE_SYM | bool_pri IS FALSE_SYM | bool_pri IS not FALSE_SYM | bool_pri IS UNKNOWN_SYM | bool_pri IS not UNKNOWN_SYM | bool_pri ; bool_pri : bool_pri

ANTLR grammar from bison

可紊 提交于 2019-12-10 10:54:27
问题 I'm trying to translate a grammar from bison to ANTLR. The grammar itself is pretty simple in bison but I cannot find a simple way for doing this. Grammar in bison: expr = expr or expr | expr and expr | (expr) Any hints/links/pointers are welcome. Thanks, Iulian 回答1: In ANTLR, you cannot create left recursive rules: a : a b ; tail recursion is fine: a : b a ; For more information on left recursive rules, see ANTLR's Wiki. So, your example could look like: parse : expr+ EOF ; expr : orExpr ;