Antlr interest
   6 tags on

1 answer

Intellij Antlr4 Plugin Left direct recursion doesn't work

I'm trying to make parser using Antlr4 for the sql select statement, in which contains the following part expr: '1' | expr('*'|'/'|'+'|'-'|'||') expr; // As the re-factored form of expression: ...

2 answers

ANTLR 3 Even Number

I'm trying to solve a pretty simple grammar problem (I just started learning about using ANTLR to develop grammars; I'm a bit new so just bear with me) which is to define a signed even number using …

2 answers | yesterday by bgd53 on Stack Overflow stackoverflow.com
0 answers

Validate antlr-grammar online

Does anyone know if there exists some kind of online-testing environment for antlr-grammars where i can validate and test a given grammar against some input strings...? Would be glad for any help!

1 answer

How to use macrodef?

Lets assume this is my code. buildJar is my macrodef. <target name="build"> <buildJar build.dir="module1"/> <buildJar build.dir="module2"/> </target> …

1 answers | yesterday by user3492304 on Stack Overflow stackoverflow.com
1 answer

Can't figure out grammar tweak

I'm trying to build a v4 grammar for an existing DSL, and am a bit out of my depth. I've tried everything I could think with no luck. We can have a function call like foo(param1, param2);, which I …

1 answers | yesterday by Brian Krahmer on Stack Overflow stackoverflow.com
0 answers

parse program with tokens at fixed positions in a line

I am new to Antlr and need to write a parser for a legacy assembly code that may have line numbers in fixed columns. Also, certain columns have significance - whether its a comment, continuation, etc. …

1 answer

Parsing script that contains logic to execute

I recently started to look at ANTLRv4 to give ability to users of my application to provide their custom logic for a specific domain. I found in many places that embedding logic inside the grammar is …

1 answers | yesterday by Mickael Marrache on Stack Overflow stackoverflow.com
0 answers

Resource is currently edited in another editor" after saving grammar file

I am using antlr4ide plugin with Eclipse Luna. Every time I save the ANTLR4 grammar file Eclipse shows a dialog box "The resource is currently edited in another editor. Do you want to continue?" Any …

1 answer

How do I know where a task came from in gradle?

I have a complicated gradle build system that I inherited. It works pretty well, but includes multiple plugins (java, groovy, antlr, jacoco, jetty, etc.). I could not figure out how to accomplish …

1 answers | 2 days ago by C Dorman on Stack Overflow stackoverflow.com
1 answer

ANTLR4 - parse a file line-by-line

I try to write a grammar to parse a file line by line. My grammar looks like this: grammar simple; parse: (line NL)* EOF line : statement1 | statement2 | // ...

1 answers | 2 days ago by Mats on Stack Overflow stackoverflow.com
0 answers

Antlr3 warning: Decison can match multiple alternatives but I don't see how

Here is the warning message in question: BB_LLVM2AST.g:120:15: Decision can match input such as "'a'..'z'" using multiple alternatives: 1, 2 As a result, alternative(s) 2 were disabled for that …

1 answer

Keyword “returns” in ANTLR4

I'm currently adapting several ANTLR3 grammar files for ANTLR4. Some of the old ANTLR3 rules use the returns keyword. This rule is valid in both ANTLR3 and ANTLR4: aRule: returns [String s] ...

1 answers | 2 days ago by hendryau on Stack Overflow stackoverflow.com
0 answers

Antlr grammar with EBNF

I'm trying to generate a Lexer/Parser through a simple grammar using ANTLR. What I've done right now : grammar ExprV2; @header { package mypack.parte2; } @lexer::header { package mypack.parte2; } …

0 answers

Intellij will not recognize antlr generated source code

I am having trouble getting Intellij to recognize the generated source code from antlr4. Any reference to the generated code appears as errors, code completion doesn't work, etc. I am using maven …

1 answer

If/else statements in ANTLR using listeners

I'm creating a simple programming language for a school project. I'm using ANTLR 4 to generate a lexer and a parser from my grammar. Until now, I have been using ANTLRs listener pattern to apply the …

1 answers | Sep 17 at 7:59 by simonbs on Stack Overflow stackoverflow.com
1 answer

running java program written in Eclipse IDE that uses anltr3 grammars via command line

I've written a class that utilizes antlr grammars in the Eclipse IDE that i'm having trouble running outside Eclipse. Here is my directory: I run: antlr3 *\.g Next I run javac -cp ...

1 answer

Unordered Sub-Productions in ANTLR4

I want to specify a production in ANTLR where the order of its sub-productions does not matter. Note that I want each of the sub-productions to occur once. The brute force way to accomplish this would …

1 answers | Sep 16 at 19:48 by hendryau on Stack Overflow stackoverflow.com
0 answers

ANTLR4 | Visual Studio 2013 | Portable Code Library

I'm trying to build a Portable Class Library using ANTLR4. I've added the necessary packages and in a normal project VS allows me to add any of the ANTLR items in the normal add new item way. I do not …

2 answers

“FOLLOW_set_in_”… is undefined in generated parser

I have written a grammar for vaguely Java-like DSL. While there are still some issues with it (it doesn't recognize all the inputs as I would want it to), what concerns me most is that the generated C …

2 answers

Modifying a plain ANLTR file in background

I would like to modify a grammar file by adding some Java code programatically in background. What I mean is that consider you have a println statement that you want to add it in a grammar before ...

2 answers | Sep 15 at 9:11 by Hakan on Stack Overflow stackoverflow.com
1 answer

How Get error messages of antlr parsing?

I wrote a grammar with antlr 4.4 like this : grammar CSV; file : row+ EOF ; row : value (Comma value)* (LineBreak | EOF) ; value : SimpleValueA | QuotedValue ; Comma : ',' …

1 answers | Sep 14 at 22:22 by Hamed F on Stack Overflow stackoverflow.com
2 answers

Is there any ANTLR4 vim syntax file?

I was only able to find this one (https://github.com/rollxx/vim-antlr), but it was made for version 3. Does anyone knows where I can find proper syntax for version 4?

2 answers | Sep 14 at 19:50 by Fuad Saud on Stack Overflow stackoverflow.com
0 answers

How can I ignore all other characters except my own created tokens in Lexer Rules?

I have created some lexer rules to match some tokens in my input file. I want to eliminate all other characters from my input file in a single line (i.e followed by line break) other than my own ...

1 answer

Ignore first “0” in ANTLR4?

I'm currently working on my MIPS Assembler and sooner or later was confronted with a problem. Instructions like these: JAL $000A2000 turned out (in hex) as: 0C 00 28 80 which is wrong, as this …

1 answers | Sep 13 at 19:02 by Tetragrammaton on Stack Overflow stackoverflow.com
1 answer

Collapsing whitespace in ANTLR4

In my grammar, I have a whitespace token that is sent to the HIDDEN channel: SP : [ \u00A0\u000B\t\r\n] -> channel(HIDDEN); I know that I can get the text of a parsed rule, including hidden ...

1 answers | Sep 12 at 17:48 by NickAldwin on Stack Overflow stackoverflow.com
1 answer

Canonicalizing token text in ANTLR

Is there a way in ANTLR to mark certain tokens as having canonical output? For example, given the grammar (excerpt) words : FOO BAR BAZ FOO : [Ff] [Oo] [Oo] BAR : [Bb] [Aa] [Rr] BAZ : [Bb] [Aa] [Zz] …

1 answers | Sep 12 at 17:33 by NickAldwin on Stack Overflow stackoverflow.com
1 answer

Match sub-rule backwards in ANTLR4 parser

I have a portion of an ANTLR4 rule that I'd like to parse backwards. I suspect that's not the real solution, so there's likely something I'm missing. The crux of my problem is that there's a part in …

1 answers | Sep 12 at 3:38 by NickAldwin on Stack Overflow stackoverflow.com
1 answer

Exact String parsing on antlr4

I am having an issue while doing the parsing of my file. Scenario as follows : In the file i got to parse, i have values as follows ABC/123/TEST The first 3 letters are some kind of identifiers, …

1 answers | Sep 11 at 5:54 by user3816763 on Stack Overflow stackoverflow.com
1 answer

ANTLR3 lexer returns one token when expecting to return 5 tokens

Hello i'm trying to build a simple lexer to tokenize lines starting with an ';' character. This is my lexer grammar: lexer grammar TestLex; options { language = Java; filter = true; } @header …

1 answers | Sep 10 at 23:11 by Steven Myers on Stack Overflow stackoverflow.com
0 answers

Issues parsing a test file with ANTLRv4

I've defined a grammar in ANTLRv4, as well as written a small example file to test it's parsing, and it is constantly giving me the error: line 1:0 mismatched input 'import' expecting 'class' the …

15 30 50 per page
1 2 3