Antlr interest
   6 tags on

1 answer

antlr4 grammar - Mismatched input error

I have a very simple grammar here: grammar mygrammar; prog : E 'arrow' ('and' E PATTERN) ; PATTERN : ( BPATTERN | ('and' PATTERN)+ | ('or' PATTERN)+ ) ; BPATTERN : ( L | P ('and' E PATTERN) ) ; L : ...

0 answers

Report ambiguous derivations in ANTLR4

When there is an ambiguity in the grammar, ANTLR4 reports it at parse-time. Using the standard diagnostics, I get something like this: line 1:4 reportAmbiguity d=107 (basicShape): ambigAlts={1, 2}, ...

1 answer

Is ANTLR Visitor the right tool for my usage

I am using ANTLR4 and here some context: my grammar: I am using the made available tsql grammar. I extend and modified this grammar a little bit with a few exceptions. my generated java classes ...

1 answers | 5 hours ago by Nappy Boy on Stack Overflow
0 answers

Creating a markdown parser with ANTLR

I am an ANTLR newbie. I am trying to implement a markdown to HTML translator. These are the grammar and the associated files that i coded. Grammar grammar markdown; prog : stat+; stat : ...

1 answer

antlr How to specify regular expressions with the repitition between 2 to infinity

How to specify regular expressions with the repitition of ANTLR between 2 to infinity Thanks

1 answers | 19 hours ago by psam on Stack Overflow
1 answer

ANTLR label heterogenous alternatives?

I would like to crate a grammar to define alternatives for events. This time: type='at ' date | type='before ' date | type='vor ' date ; date: ...

1 answers | yesterday by Mike75 on Stack Overflow
1 answer

Lexer mode inside a string in Antlr4

I have an ANTLR4 grammar for a specific JSON format (I know, I should be using JSON Schema, but let's ignore that for now) As part of my JSON object, I would like to match a string like this: ...

2 answers

How to split an ANTLR grammar file into multiple ones

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 if ...

1 answer

How can I access the ANTLR parse tree?

I am using ANTLR v. 4.5.2, ANTLRWorks 2.1 and the made available grammar for tSQL right now. ANTLRWorks generates me a perfect parse tree from my SQL code but I want to use ANTLR in my webapplication ...

1 answer

Trouble Setting Up ANTLR 4 IDE on Eclipse Luna (4.4)

I'm trying to install the ANTLR 4 IDE on Eclipse Luna (4.4). I've installed it from the Marketplace but I have no idea how to create a project that has an ANTLR 4 Lexer/Parser in it. When I go to ...

1 answer

Accepting grammar with single quotes

I need to write a grammar in antlr4 that accepts the date and time within the single quotes and then have to print the same as output. For example: the date/time = '2007-08-01T01:00:00,000+01:00'. If ...

1 answers | yesterday by user2085189 on Stack Overflow
1 answer

Trying to use keywords as identifiers in ANTLR4; not working

I'm trying to get some sql keywords to be accepted as identifiers, when used as identifiers. The Antlr book p210 suggests this trick: id : 'if' | 'call' | 'then' | ID ; I've got something similar ...

1 answers | yesterday by user3779002 on Stack Overflow
0 answers

ANTLR tree has no child nodes?

So, I have a very simple ANTLR4 grammar: grammar TestGrammar; @header { package com.xxxxxx; } start_rule: (Function | IDENTIFIER)* EOF; Function : IDENTIFIER Parameter ; ...

3 answers

ANTLR 4: Avoid error printing to console

With ANTLR I parse a grammar. The ANTLR errors are indicated in a custom editor for the grammar. However I would like to disable the printing of error messages to a Java console. I've implemented my ...

3 answers | 2 days ago by Marcel on Stack Overflow
0 answers

Error in ANTLR4 when running the tool

I am new to antler. I am fooling the procedures in After running the command "antler4 hello.g4" I got the following errors:enter ...

Feb 7 at 22:40 by Urja on Stack Overflow
0 answers

How can I save Parse Tree Visualization as Image in Eclipse?

I've installed Antlr4 plugin and use Parse Tree visualization in Eclipse. I want to know How I can save the Parse Tree figure as image ? I'm using Eclipse Mars Release (4.5.0). for example as you ...

3 answers

Python: UnicodeEncodeError when reading from stdin

When running a Python program that reads from stdin, I get the following error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 320: ordinal not in range(128) How can I fix it? ...

3 answers | Feb 6 at 3:15 by hansfbaier on Stack Overflow
0 answers

generated files from ANTLR conflict in visual studio between release and debug modes

I use ANTLR4 with Visual Studio and C#. During the build process the ANTLR4 tool generates 6 C# source files (i.e Parser, Lexer, Visitor, Listener etc) that correspond to the parser the ANTLR ...

1 answer

ANTLR4 - DotGenerator example

Where I can find example how to use org.antlr.v4.tool.DotGenerator in ANTLR4? As I understand, it replaces DOTTreeGenerator in ANTLR4.

1 answers | Feb 5 at 11:45 by Marat on Stack Overflow
0 answers

Incremental parsing using ANTLR4

We use ANTLR4(in c#) in custom IDE to parse object-oriented language. Results from parser help us create some set of features (code highlighting, code assistance, region outlining etc.). But for ...

2 answers

ANTLR grammar for multi-level text segmentation

I want to create a grammar that will parse a text file and create a tree of levels according to configurable "segmentors". This is what I have created so far, it kind of works, but will halt when a ...

2 answers | Feb 5 at 8:08 by spyk on Stack Overflow
0 answers

C source-code parser

I am trying to make a tool that can detect a change impact on C source-code. Impacted variables, functions or interfaces, i was thinking about making my own static code analyzer using language grammar ...

2 answers

How to remove Left recursive in this ANTLR grammer?

I am trying to parse CSP(Communicating Sequential Processes) CSP Reference Manual. I have defined following grammer rules. assignment : IDENT '=' processExpression ; processExpression : ...

0 answers

Add if-else and do while to my grammar

Hi guys I did this little grammar to implement a simple calculator , but I need to add IF - ELSE and DO WHILE to my grammar but I don't know how to work with the jumps and I don't really know what I ...

0 answers

Why is whitespace(' ') returning <EOF> in my code?

grammar VB6; /* * Parser Rules */ compileUnit: module+ EOF; module:declareStmt ; declareStmt :WS? eqnStmt #eqStatement; eqnStmt: VAR WS? EQ WS? NUM; /* * Lexer Rules */ NUM:[0-9]+; VAR: LETTER ...

1 answer

antlr4 empty alternative not working as expected

I'd presumed that in general the rule rule: ( something ? ) ; could generally be expressed as alternation with nothing, with identical semantics rule: ( something | ) ; <-- empty alt here ...

1 answers | Feb 3 at 18:46 by user3779002 on Stack Overflow
0 answers

ANTLR4: Whitespace and Space lexical handling

In my (simplyfied) grammar grammar test; prog: stat+; stat: sourceDef ';' ; sourceDef: SRC COLON ID ; STRING : '"' ('""'|~'"')* '"' ; // ...

1 answer

No matching distribution found for antlr-python-runtime

pip install google_appengine Collecting google-appengine Using cached google-appengine-1.5.1.tar.gz Collecting pyyaml (from google-appengine) Using cached PyYAML-3.11.tar.gz Collecting webob==0.9 ...

1 answers | Feb 3 at 5:14 by kev on Stack Overflow
1 answer

Antlr - not able to use Lexer token if it is assigned to another token in grammar

"In this example if i use 'MID('int = VALUE')' then it works fine. I want MID to be validated for INT value but when i use INT it gives error "mismatched input '9' expecting INT. I am using ...

1 answers | Feb 2 at 14:26 by Vipluv on Stack Overflow
1 answer

ANTLR parser node type + Tree Adopter?

I have developed small ANTLR grammar. which contains three files. GLexer.g : lexer GParser.g : parser of tpye AST GWalker.g : tree parser Also I have custom tree node GTree (extends CommonTree) ...

1 answers | Feb 2 at 5:44 by Sanjiv on Stack Overflow
15 30 50 per page
1 2 3