antlr4 Questions

2

In Antlr 4, I have a grammar which takes strings of format x*Y, x+y, etc I want to catch an error when an invalid operator is used, such as x&y. If I add code like: parser.RemoveErrorListener...
Metabolize asked 9/5, 2016 at 22:41

1

Solved

I have rules that look something like this: INTEGER : [0-9]+; field3 : INTEGER COMMA INTEGER; In the parsed tree I get an List called INTEGER with two elements. I would rather find a way for ea...
Lon asked 8/5, 2016 at 23:29

3

I am wondering if are there any examples (googling I haven't found any) of TAB auto-complete solutions for Command Line Interface (console), that use ANTLR4 grammars for predicting the next term (l...
Convoy asked 6/5, 2016 at 9:12

2

I'm using the JSON grammar from the antlr4 grammar repository to parse JSON files for an editor plugin. It works, but reports invalid chars one by one. The following snippet results in 18 lexer err...
Maidamaidan asked 28/3, 2016 at 20:32

1

Solved

I have Java code generated from ANTLR4. Scala is using the Java code by extending some of the methods. The issue is that IntelliJ's scala plugin does not seem to know the relationship between Java ...
Brinna asked 17/4, 2016 at 17:44

3

Solved

so found a nice grammar for a calculator and copied it with some lil changes from here: https://dexvis.wordpress.com/2012/11/22/a-tale-of-two-grammars/ I have two Files: Parser and Lexer. Looks li...
Graeae asked 30/10, 2014 at 9:32

1

Solved

I'm currently trying to develope a JavaScript Compiler with the help of an Antlr4 Visitor. I've got this already implemented with Java but cannot figure out how to do this in JavaScript. Probably s...
Octahedrite asked 16/2, 2016 at 14:18

1

Solved

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 trou...
Ewaewald asked 24/2, 2016 at 15:1

2

Introduction Looking at the documentation, ANTLR 2 used to have something called predicated lexing, with examples like this one (inspired by Pascal): RANGE_OR_INT : ( INT ".." ) => INT { $set...
Otranto asked 1/3, 2016 at 13:20

1

Solved

I'm pretty new to ANTLR4 and now I'm trying to undertand which kind of grammars we might define with it. As far as I got, there're two kind of rules in ANTLR: parser rules (lower case words) and ...
Skyjack asked 25/2, 2016 at 14:55

1

I am using the ANTLR4 IntelliJ plug-in, and I am using a the Antlr-4.5.1 Jar. When I Generate Antlr Recognizer in Lexer and Parser can't resolve symbols RuntimeMetaData and Vocabulary. If I use t...
Frankforter asked 29/1, 2016 at 11:0

2

I have a large grammar file, and plan to split it into multiple ones, so that I can reuse some of those smaller files in another grammar file. I have tried doing it but failed. Can you please tell ...
Gott asked 7/10, 2015 at 6:34

1

Solved

I have a .g4 grammar for vba/vb6 a lexer/parser, where the lexer is skipping line continuation tokens - not skipping them breaks the parser and isn't an option. Here's the lexer rule in question: ...
Moustache asked 5/1, 2016 at 21:56

4

I found an ANTLRv4 Python3 grammer, but it generates a parse-tree, which generally has many useless nodes. I'm looking for a known package to get a Python AST from that parse tree. Does somethi...
Cleary asked 15/7, 2014 at 19:25

1

Solved

I'm (now) trying to use ANTLR4 and C# to design a language, and so far I've been fiddling around with it. In the process, I decided to try and create a simple mathematical expression evaluator. In ...
Buchanan asked 31/10, 2015 at 0:20

1

Solved

Suppose I have the following: variableDeclaration: Identifier COLON Type SEMICOLON; Type: T_INTEGER | T_CHAR | T_STRING | T_DOUBLE | T_BOOLEAN; where those T_ names are just defined as "integer"...
Secluded asked 18/10, 2015 at 13:57

1

Solved

I'm trying to use ANTLR V4 with the publicly given Java 8 grammar - https://github.com/antlr/grammars-v4/blob/master/java8/Java8.g4 I generated the class files and tried to parse the Java 8 JRE, b...
Ary asked 2/10, 2015 at 14:55

0

In the language I work with, some keywords must be at the start of the line. This is mainly because string values within the language can go over multiple lines, and strings could easily contain th...
Castellatus asked 30/9, 2015 at 16:8

1

Solved

I created a grammar for boolean expressions and now I'm trying to implement visitor for evaluating it. It is told that there is no need to overcomplicate grammar lexer and parser rules with semant...
Kumamoto asked 3/9, 2015 at 16:33

2

I have a very simple test grammar as following: grammar Test; statement: expression EOF; expression : Identifier | expression binary_op expression | expression assignment_operator expression ...
Ollieollis asked 31/8, 2015 at 21:32

1

Solved

I want to catch errors like line 1:1 extraneous input '\r\n' expecting {':', '/',} line 1:1 mismatched input 'Vaasje' expecting 'Tafel' I tried wrapping my functions in try-catch but, as expect...
Siouxie asked 26/8, 2015 at 11:6

1

Solved

I'm trying to create a Beginning-Of-Line token: lexer grammar ScriptLexer; BOL : {getCharPositionInLine() == 0;}; // Beginning Of Line token But the above emits the error The name 'getCharPosi...
Gaff asked 9/8, 2015 at 11:27

1

Solved

I have a simple HelloWorld.g4 grammar (see it at the bottom). I am able to successfully generate the .py files using this: set CLASSPATH=.;antlr-complete.jar;%CLASSPATH% java org.antlr.v4.Tool -D...
Gibber asked 5/8, 2015 at 19:25

2

Solved

I am currently researching for an elegant way, for my REST API under development, to express filters for GET requests returning collections. I'd like to express queries as "http://[...]?filter=expr...
Riana asked 19/2, 2015 at 23:54

2

Solved

I'm trying to use antlr4 version 4.4 and the python2 runtime. The grammar is from the antlr4 book, page 6, file: Hello.g4: grammar Hello; r : 'hello' ID ; ID : [a-z]+ ; WS : [ \t\r\n]+ -> skip...
Hadj asked 5/8, 2014 at 10:22

© 2022 - 2024 — McMap. All rights reserved.