Antlr interest
   6 tags on

1 answer

Antlr4: line 1:14 extraneous input 'w' expecting {<EOF>, ';', ' '}

I try to write a Grammar which checks if the following data (a csv-file) is valid: w;w;w;s;s;s;s w;s;w;w;w;w;w w;s;w;w;w;w;w w;s;w;s;s;s;w w;s;w;w;w;w;w w;s;w;w;w;w;w w;w;s;s;w;w;w * Define a ...

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

ANTLR: rewrite parse rule with *

I have a problem in ANTLR about the rewrite of a parse rule. Grammar is as follows (I have cut some less interesting parts): grammar FOOL; options { output=AST; } @parser::header { package ...

0 answers

ANTLR3 warning(200):Decision can match input such as “'p'” using multiple alternatives

grammar prdl; cs : '[' a ']'; a : 'x' ('p' a)*; Here is my simplified grammar that still get the warning(200):Decision can match input such as "'p'" using multiple alternatives:1,2 ...

1 answer

Can ANTLR lexers/parsers be used for VS syntax highlighting and Error List?

I'm happily developing a language in ANTLR 4.4 / ANTLR4CS, and I'd like to start integrating my language into an IDE. The natural place for me feels like integrating it into Visual Studio. It occurs ...

1 answer

Changing token value in ANTLR4 lexer

I'm trying to parse a language in ANTLR4 that is case-insensitive as far as identifiers go. If possible I'd like to push this onto the lexer, something like: IDENT : [a-zA-Z]+ { /* set token = ...

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

How can one use a lexer in a package with a parser in a different package?

This question concerns Antlr, the parser/lexer generator (Which is pretty awesome IMO). Specifically, the version in question is Antlr4. Currently I'm playing around trying to create a parser/lexer ...

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

ANTLR3: compiling warning(200) “multiple alternatives”

I'm using antlrworks1.5 with antlr3 and encountered the following warning/error. I have been working on this issue for a couple of days, could anybody give me some hint? Thank you in advance. The ...

1 answers | May 21 at 12:21 by user4918568 on Stack Overflow stackoverflow.com
1 answer

How do I build ANTLR 3 grammars with import using Gradle?

I have a base grammar (FooBase.g) and two grammar that include it: lexer grammar FooVariantA; import base = FooBase; ... lexer grammar FooVariantB; import base = FooBase; ... If I put all three ...

1 answers | May 20 at 13:38 by doublep on Stack Overflow stackoverflow.com
1 answer

ANTLR4 and the Python target

I'm having issues getting going with a Python target in ANTLR4. There seems to be very few examples available and going to the corresponding Java code doesn't seem relevant. I'm using the standard ...

1 answers | May 20 at 9:19 by Dustin Oprea on Stack Overflow stackoverflow.com
2 answers

ANTLR : Generate back source file from AST

I have modified the PLSQL parser given by [Porcelli] (https://github.com/porcelli/plsql-parser). I am using this parser to parse PlSql files. After successful parsing, I am printing the AST. Now, I ...

2 answers

context sensitive lexing & parsing

I have a set of files to parse that has this weird contents. Each line contains the following data(removing all the other contents of no relevance here): DATA < Alphabetic data> < numeric ...

2 answers | May 20 at 5:52 by an tlernovis on Stack Overflow stackoverflow.com
1 answer

Does antlr4 support adaptive grammar?

Does antl4 support adaptive grammars that allows the user to specify new rules, such as enforcing the number of arguments specified in a function declaration? Example: Base language includes the ...

1 answers | May 19 at 21:37 by Lugh on Stack Overflow stackoverflow.com
1 answer

ANTLR 4 Parser Grammar

How can I improve my parser grammar so that instead of creating an AST that contains couple of decFunc rules for my testing code. It will create only one and sum becomes the second root. I tried to ...

0 answers

NoSuchElementException from Scanner I think there is something wrong with my Path?

Hello I'm checking out ANTL. I tried to make a Parser for calculations (at this point just additions work like 1+2+3 or similar). It turned out that my Scanner throws a NoSuchElementException if he ...

1 answer

What is the best practice for Java code file modification?

This question might sound duplicate of this question but they are not the same. I am dealing with some legacy code in which logging was done at entry and exit of most (not all) of the functions of a ...

1 answers | May 19 at 6:29 by Siddharth on Stack Overflow stackoverflow.com
0 answers

ANTLR cannot generate Ruby code as of version 4.5

Why does my grammar can't be generated to ruby target? I have ruby 2.2.1 and NTLR version 4.5. What should I do to get working grammar on ruby code?

May 18 at 15:46 by freeze on Stack Overflow stackoverflow.com
0 answers

ANTLR3 c target: when rule fail, action still execute, i can't understand

when rule fail, action still execute, why? There is my test: grammar Test; options{ language = C; } @parser::includes { #include <iostream> } @lexer::includes { #include ...

1 answer

Handling errors in ANTLR4 JavaScript

I am using ANTLR4 JavaScript to create a sort of a web IDE for a custom language. It all works great, apart from the fact that errors are logged to the console and I can't figure out a way to ...

0 answers

If statement in ANTLR

I am implementing statement using ANTLR3. I have a grammar file to parse and a translator(tree walker) to interpret the if statement. IF : 'if' ; THEN : 'then' ; ELSEIF : ...

1 answer

Set Antlr4 custom generation path relative to project root?

Using the Antlr4 intellij plugin. I want to customise the directory into which Antlr puts generated code. Right-Clicking the grammar file and selecting Configure Antlr... enables this: Output ...

1 answers | May 16 at 21:36 by sfinnie on Stack Overflow stackoverflow.com
0 answers

Making AST using antlr3 in reverse order

I'm learning antlr3 and for it I'm modifying a Javascript grammar (I got the grammar from here) to add supporting for AST generation. Now, I'm trying to add AST support for "function calls" using ...

1 answer

antlr visitor is returning an empty parse tree

so I'm trying to print the lexemes that are being visited during lexical analysis phase, here's the code of the method that is doing so: public void parse(String inputFile) { InputStream is = ...

1 answer

NoViableAltException when parsing string literals with ANTLR

I am very new to ANTLR, trying to parse a simple PL/SQL function. My apologies if this is a silly question. function MyFunc return boolean is begin IF :USER_ID_P IS NULL THEN ...

1 answer

How to parse C# code then serialize it back to text file

I found that there is C# antlr4 grammar. I build antlr4 parser for C# for that grammar. It works. I can walk the parse tree and see that there are some nodes that have some children. Now I would like ...

1 answers | May 15 at 18:56 by Kamil Szot on Stack Overflow stackoverflow.com
1 answer

creating query back from parsed hive ASTNode

Modifying hive query programmatically- I am parsing hive query using ParseDriver.parse() method to get the parsed ASTNode tree. The use case to add some where clauses to it for row level security. ...

1 answer

ANTLR - how to skip missing tokens in a 'for' loop

I'm developing a 'toy' language to learn antlr. My construct for a for loop look like this. for(4,10){ //program expressions }; I have a grammar that I think works, but it's a little ugly. ...

1 answers | May 15 at 4:59 by phatmanace on Stack Overflow stackoverflow.com
2 answers

Antlr 4 Generate Parse Tree Code in Java

Using Antlr4, I want to generate the parse tree in the form of Java/JavaScript code. This is what my main.Java looks like String sql = "SELECT log AS x FROM t1 \n" + "GROUP BY x\n" ...

2 answers | May 15 at 0:32 by user3898179 on Stack Overflow stackoverflow.com
0 answers

How to rewrite this grammar so it's not ambiguous anymore

I am currently working on a grammar which should allow me to define localand global Arrays or Variables. The local ones start with an underscore and that's the only differnece in the names. There are ...

1 answer

How to define alphanumeric token in antlr?

I'd like to have an alphanumeric lexer rule, a token of any combination of letters and digits, here's my grammar grammar Equery; query: queryTerm+; queryTerm: filter | '(' queryTerm ')' ...

1 answers | May 13 at 2:03 by Jiaji on Stack Overflow stackoverflow.com
0 answers

Using ANTLR “.text” rule attribute with UnbufferedTokenStream

I have an ANTLR v3 tree grammar that uses the *.text attribute. For example: assignToVarCommand : ^(ASSIGN varString expr) { m_visitor.assignVar( $varString.text, $expr.value); }; This leads to ...

15 30 50 per page
1 2 3