Antlr interest
   6 tags on

0 answers

ANTRL 3 grammar omitted part of input source code

I am using this ANTLR 3 grammar http://research.xebic.com/es3/ and ANTLR works for testing that grammar. But I can't figure out why are some parts of my input text omitted? I would like to rewrite …

1 answer

Grammar not recognizing || (OR) operator

I have the following grammar: cond_stmt: ('('cond_stmt')'|('!' cond_stmt)| cond_expr|cond_or|cond_and) ; cond_or: cond_expr(OR cond_stmt)+; cond_and: cond_expr(AND cond_stmt)+; OR:'||'; AND: ...

1 answers | yesterday by Abhinav kumar on Stack Overflow stackoverflow.com
2 answers

ANTLR4: Get end position of a context

I'm trying to get start and end position (line and column) of a context in ANTLR4. I'm working with this Python3 grammar. I wrote a listener, that prints start and end line: class MyListener extends …

0 answers

Is there an ANTLR4 grammar for YAML?

Since YAML has a rather complicated syntax, is it possible to write a parser for YAML mainly using ANTLR4 ? I was looking for examples, that implement the YAML like indentation parsing and the ...

Aug 30 at 6:56 by JE42 on Stack Overflow stackoverflow.com
1 answer

ANTLR3 - How to get the text of repeating token

I am using ANTLR3 C version, the grammar snippet is like this: a_cmd : sub_cmd+ 'abc' (sub_cmd)? ; Now I need to get the whole text of all the first sub_cmd, the repeated one. I tried ...

1 answers | Aug 29 at 17:13 by my_question on Stack Overflow stackoverflow.com
0 answers

how to get children in antlr4 with python target?

I wrote a grammar in antlr4 with python target and got Parser,Lexer and Listener, now what I want is to get children of specific node and do some calculation on them, this is part of my grammar: ...

0 answers

Treeparsers with filtering

Is it possible to use it? According these links (1, 2) it should work. But I can not get any reasonable output from it. I use a grammar from Python target test suite (test t047). But even with the …

Aug 28 at 9:26 by Ivan on Stack Overflow stackoverflow.com
1 answer

AST Parser tree ANTLR4

After making these with: java org.antlr.v4.Tool -visitor -lib scanner/ parser/Decaf.g, that instruction generated(DecafParserBaseListener.java, DecafParserBaseVisitor.java, DecafParserListener.java, …

2 answers

How to not hard code rule values in grammar

My grammar contains the following (condensed): block: : specialfunction specialfunction : SPECIALFUNCTION OPAR (parameter (',' parameter)*)? CPAR ; SPECIALFUNCTION : 'FUNCTION1'| 'FUNCTION2'; …

2 answers | Aug 28 at 4:10 by XBond on Stack Overflow stackoverflow.com
1 answer

Is it possible to make Antlr4 generate lexer from base grammar lexer instead of gener Lexer?

I have lexer grammar called BasicTokens which is set of basic tokens for my language, having tokens like null, true, false etc. Now when I create parser grammar say BasicGrammar which imports refers …

1 answers | Aug 28 at 2:50 by babbupandey on Stack Overflow stackoverflow.com
0 answers

Using Java code in antlr grammar g4 file

I would like to define a grammar that should parse words that are related to units of measure e.g. for kilograms: 'kg', 'KG', 'kilogram', 'kilograms', 'l', 'liters', 'litres' etc. I am already doing …

1 answer

Antlr 4 Error Recovery

My script language contains a series of macros, rule defined as following program : macrodeclaration* EOF ; macrodeclaration : (STATIC)? 'MACRO' STRING declareparameter statement* ...

1 answers | Aug 27 at 19:34 by JLi on Stack Overflow stackoverflow.com
0 answers

How to identify tokens with single quotes by using LT(1)

I am trying to parse the following text: ss1111 22'2'2 '3333' 4444 /end Using the following part of an ANTLR grammar: ({notend = LT(1);}~END)* end:END; END : "/end"; I am facing the problem ...

1 answer

ANTLR4: get next possible matching parser rules for the given input

I have a grammar (antlr4) file with both lexer and parser rules. I have extended the generated *BaseListener class and overridden public void visitErrorNode(@NotNull ErrorNode node) {} method. ...

1 answers | Aug 27 at 3:28 by Muruges on Stack Overflow stackoverflow.com
1 answer

Antlr evaluation order quesiton

I defined the following expression rule using Antlr 4 for a script language, basically I am trying to evaluate x = y.z.aa * 6 the correct evaluation order should be y.z then y.z.aa then it times …

1 answers | Aug 26 at 19:55 by JLi on Stack Overflow stackoverflow.com
1 answer

What's wrong with this example ANTLR 3 Python grammer?

I'm trying to learn to use ANTLR, and seem to have come across an error while following this "tutorial": https://theantlrguy.atlassian.net/wiki/display/ANTLR3/Five+minute+introduction+to+ANTLR+3 ...

1 answers | Aug 26 at 8:46 by Chris Covert on Stack Overflow stackoverflow.com
0 answers

How can I use antlr output files to create a translator?

I'm extremely new to programming and only have a year of comp sci experience I used Antlr to produce C++ lexer and parser files, based on a proprietary language grammer file. My goal is to create a …

2 answers

Expressions in a CoCo to ANTLR translator

I'm parsing CoCo/R grammars in a utility to automate CoCo -> ANTLR translation. The core ANTLR grammar is: rule '=' expression '.' ; expression : term ('|' term)* -> ^( OR_EXPR term …

0 answers

Transformation with antlr (morph?) for only one single node

This should be fairly simple, but I cannot find the relevant information in the documentation. I have an sparql query, and I have an antlr grammar that produces an AST for it, I would like to produce …

1 answer

Query language translators

Can anyone share some references or, even better, examples of how to define a simple custom query language and then create a translator for queries in this language to SQL queries? I think antlr can …

1 answers | Aug 25 at 21:14 by Bert Lung on Stack Overflow stackoverflow.com
2 answers

How to continue parsing after an error in Antlr 4.4

Does any one knows if there is an ErrorStrategy on Antlr4.4 to continue parsing after an error is found, i need to show all the errors found in the program but Antlr stop parsing after the first error …

2 answers | Aug 25 at 15:47 by vash on Stack Overflow stackoverflow.com
1 answer

Unit-testing the semantic analysis visitors of an ANTLR-based tree

I'm developing a small compiler. In past compilers I've worked with I just ignored unit-testing, doing all my testing via system-tests. It worked reasonably well, but I felt it always to be far from …

1 answer

how do I handle conflicting function names between my antlr grammar and target language

I have a grammar that contains function names called eval and round, these are already functions in python and when I try to generate the listener using: antlr4 -listener -lib /src/grammar ...

0 answers

IDE integration with custom language implemented with Antlr4

We wrote a custom language using Antlr4 and I was wondering what tools (open source will be perfect) are available to create an IDE for this language implemented by antlr4. I'd like to make an IDE ...

Aug 22 at 21:30 by XiaoqinLI on Stack Overflow stackoverflow.com
1 answer

Error referrnce build.classpath not found while excuting the build file in eclipse

Below is my build.xml im trying to compile the jar.but facing the refrence.classpath not found exception. <?xml version="1.0" encoding="UTF-8"?> <project name="BookDemo" …

1 answers | Aug 22 at 11:25 by user3836185 on Stack Overflow stackoverflow.com
1 answer

Generate AST for Java with ANTLR

As far as I know, there are two mechanisms in ANTLR for building abstract syntax trees. I want to build a AST for Java source files. Question: There are so many grammar rules in Java.g (java ...

1 answers | Aug 22 at 7:06 by Fiary on Stack Overflow stackoverflow.com
1 answer

Migrating ANTLR v3 grammar to ANTLR v4

We have a grammar written for antlr V3 and I would like to migrate to antlr v4. Is there any migration Guide. and also I would like to know modifications of existing V3 grammar so that we utilize v4 …

1 answers | Aug 21 at 16:53 by user1181083 on Stack Overflow stackoverflow.com
1 answer

How Eclipse show the name of the file generated from

We use (Antlr4ide) to generate .java from .g4(antlr) files. My question is there a way to indicate in eclipse that these .java files are generated files, and maybe also show what was the file they …

1 answers | Aug 21 at 13:44 by Morpheus133 on Stack Overflow stackoverflow.com
2 answers

What should the correct grammar be for correct precedence evaluation of +,-,/,*, etc

My grammar has these rules expression : expression EQ conditionalOrExpression #eqExpr | expression NEQ conditionalOrExpression #neqExpr | expression LT ...

2 answers | Aug 21 at 8:26 by XBond on Stack Overflow stackoverflow.com
1 answer

Antlr4 Python3 target visitor not usable?

I try to follow the Antlr4 reference book, with the Python3 target, but I got stuck in the calculator example. On the Antlr4 docs it says The Python implementation of AntLR is as close as possible …

1 answers | Aug 20 at 18:51 by JasperT on Stack Overflow stackoverflow.com
15 30 50 per page
1 2 3