antlr4 Questions
2
Solved
I'am new to ANTLR4, and it seems that there is no Eclipse-Plug-In for v4. So it would nice to build automatically the Java sources from the .g4 grammars. I have a simple, empty Maven-project with s...
2
I am writing a grammar to handle scalar and vector expressions. The grammar below is simplified to show the problem I have where a scalar expression can be derived from a vector and a vector can be...
Assiduity asked 26/12, 2013 at 21:46
2
I'm using the antlr4 maven plug-in to build my maven project which uses antlr4:
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>...
1
Solved
I'm trying to write a piece of code that will take an ANTLR4 parser and use it to generate ASTs for inputs similar to the ones given by the -tree option on grun (misc.TestRig). However, I'd additio...
Litotes asked 13/10, 2013 at 21:52
1
How to control switching Antlr lexer modes from parser actions?
I extended the generated Parser and Lexer so I can call pushMode and popMode from parser witch in turn call suitable pushMode and pop...
1
Solved
I'm reading the definite ANTLR4 reference and have a question regarding one of the examples (p. 76):
STRING: '"' (ESC|.)*? '"';
fragment
ESC: '\\"' | '\\\\' ;
The rule matches a typical C++ str...
1
Solved
I'm developing a small IDE for some language using ANTLR4 and need to underline erroneous characters when the lexer fails to match them. The built in org.antlr.v4.runtime.ANTLRErrorListener impleme...
Excursion asked 13/9, 2013 at 9:5
1
Solved
My ultimate goal is to parse a structured file as a tree of in-memory objects that I can then manipulate. The file format that I'm using is fairly sophisticated with about 200 keywords/tags, and th...
1
I am learning ANTLR4 and I have no previous experience with parser generators.
When I define my own visitor implementation, I have to override methods of the BaseVisitor (I am looking for instanc...
Antibiotic asked 4/9, 2013 at 15:58
2
I'm using Antlr 4 with c# target.
Here is a subset of my grammar:
/*
* Parser Rules
*/
text : term+ EOF;
term : a1 a2 a3;
a1: ....
...
...
I want to accept valid data blocks as (term)s, when e...
1
Solved
I have upgraded from Antlr 3 to Antlr 4. I was using this code to catch exceptions using this code. But this is not working for Antlr 4.
partial class XParser
{
public override void ReportError(...
1
Solved
I have syntactic predicated that I have to convert into the Antlr 4. The grammar is not written my me so I have no idea how to convert them in a meaningful way. These are the main variations of the...
1
I want to write a lexer that has multiple modes. But the modes are mostly similar. The only difference is that I reference the same character by a different name. I have it working, the problem is ...
1
When trying to use a generated grammar and lexer I get:
org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 2 (expected 3).
What's wrong?
1
Solved
In ANTLR v4, how do we parse this kind of string with double quote escaped double quotes like in VBA?
for text:
"some string with ""john doe"" in it"
the goal would be to identify the string: s...
Ibbison asked 27/7, 2013 at 12:9
1
Solved
Is there any reliable way with antlr4 API to get Token start character position relative to the beginning of file, not line? After doing some research the only way I found is to use some custom imp...
1
Solved
I have a rule that reads as
interfaceCommands
: descriptionCmd
ipAddressCmd
otherCmd
;
Though the expected order of Cmds is as stated in the grammar, I also should be able to accept the inpu...
3
How to match any symbol in ANTLR parser (not lexer)? Where is the complete language description for ANTLR4 parsers?
UPDATE
Is the answer is "impossible"?
1
Solved
I am trying to port Chris Lambro's ANTLR3 Javascript Grammar to ANTLR4
I am getting the following error,
Rule reference 'LT' is not currently supported in a set
in the following code ~(LT)*
...
2
How to match any text in ANTLRv4? I mean text, which is unknown at the time of grammar writing?
My grammar is follows:
grammar Anytext;
line :
comment;
comment : '#' anytext;
anytext: ANY*;
...
2
Solved
Is it possible to instruct ANTLR not to load entire file into memory? Can it apply rules one by one and generate topmost list of nodes sequentially, along with reading file? Also may be it is possi...
1
Solved
I am using returns for my parser rules which works for all parser rules except the first one. If the first parser rule in my grammer uses the returns declaration ANTLR4 complains as follows:
expec...
Gaiser asked 6/5, 2013 at 10:34
1
Solved
I have the following grammar for ANTLR 4:
grammar Pattern;
//parser rules
parse : string LBRACK CHAR DASH CHAR RBRACK ;
string : (CHAR | DASH)+ ;
//lexer rules
DASH : '-' ;
LBRACK : '[' ;
RBRACK...
Chamois asked 10/5, 2013 at 15:39
2
Solved
How to achieve Perl regular expression ^ and $ in the ANLTR4 lexer? ie. to match the start of a line and end of a line without consuming any character.
I am trying to use ANTLR4 lexer to match a #...
1
Solved
What does this warning mean ?
How do I solve it ?
Here is the code I am referring to
expression : expression operator=DIV expression
| expression operator=MUL expression
| expression operato...
© 2022 - 2024 — McMap. All rights reserved.