All Questions
116 questions
0
votes
1
answer
62
views
Error regarding my Python ANTLR parser code
I am trying to parse the contents of my test case files to output files to where the token type and the production rules are displayed.
My test case is this:
[* operator test *] = != > < <= =&...
1
vote
1
answer
527
views
ANTLR not generating ParserBase
I am new to ANTLR and was looking into the CPP14 grammar here. I tried using
antlr4 -Dlanguage=Python3 CPP14Lexer.g4
antlr4 -Dlanguage=Python3 CPP14Parser.g4
Then use the following driver code:
import ...
0
votes
1
answer
1k
views
Import "antlr4" could not be resolved
I have already install antlr through
brew install antlr
but i cant import it in my vscode with this error
Import "antlr4" could not be resolved
How can i solve this problem?
I have tried ...
0
votes
2
answers
197
views
write ANTLR regex when declaring variables list
I've wrote a grammar rule for a language in ANTLR as below:
variable: idlist COLON type (EQUAL explist)? SEMI;
idlist: identifier (COMMA identifier)*;
explist: exp (COMMA exp)*;
COLON: ':';
EQUAL: '='...
-1
votes
1
answer
188
views
I want keep comments in my ANTLR parse tree for Python code
I'm using ANTLR for my Python parser but I realised that the parser doesn't recognise comments. Is there anyway to fix this because I needed to identify the comments in the parsed code?
I've used this ...
0
votes
1
answer
2k
views
Parsing python files using ANTLR
Using these steps I'm trying to generate the parse tree for Antlr4 Python3.g4 grammar file, to parse python3 code, I've generated my python parser using ANTLR. But I'm unsure how to pass in a ...
1
vote
2
answers
2k
views
I'm trying to generate the parse tree for Antlr4 Python3.g4 grammar file, to parse python3 code
I'm using ANTLR4 and trying to generate a parse tree for a python file I have. I used the grammar file python3.g4 from the ANTLR4 documentation. I have the antlr4-python3-runtime installed, and I have ...
0
votes
2
answers
256
views
How to use ANTLR4 to get a list of functions and classes in string format regardless of the programming language?
Say we have some files "index.js", "main.java", "test.rs", and I want to output a list of functions/classes (along with doc comments) in these files.
For example:
output: ...
0
votes
0
answers
68
views
Are [failing] semantic predicates in antlr4 only used for alternatives within the current rule?
Context
I am working on a parser for a language that potentially includes references database fields. The field's type affects how the input could be parsed, but there is nothing to distinguish ...
0
votes
1
answer
231
views
Antlr4 parse issues when changing lexer rule to parser rule| python
I am new to antlr, and I have been facing some issues when it comes to properly parsing the source code, this is my grammar:
compilationUnit
: (assignment | declarationList | definitionList)* EOF
...
0
votes
1
answer
128
views
Antlr4 ParserATNSimulator Debugger generate no Output
Is there a possibility to get the ParserATNSimulator Debuggingmessaging in python3 to work?
I tried to get to the core of ANTLR4 for python 3 and messed a bit with the ATN Simulation. There i wonder ...
0
votes
0
answers
50
views
Java ANTLR4 mismatched input '<EOF>' when validating python comment
This is my grammar file, I am trying to parse a comment from starting of any content. my comment is python (#) single line and (""") multiline comment.
I am getting below error during ...
0
votes
2
answers
2k
views
4.10.1 Python ATNDeserializer broken?
The Java implementation continues to work fine, but the Python implementation, which has also been working fine before the upgrade to 4.10.1, now throws a TypeError on line 89 in adjust of ...
0
votes
1
answer
1k
views
ParseCancellationException when using ANTLR4 `parser.file_input()` for Python files
I am writing Java code using ANTLR4 to parse Python files. The lexer and parser I use are Python3Lexer.g4 and Python3Parser.g4 from antlr/grammars-v4 Github. The java parsing code works fine most of ...
1
vote
2
answers
108
views
Simplify chained expression in ANTLR listener
I have an ANTLR listener for C++ where I want to get the name of a member declarator. Currently, I'm using this approach:
def enterMemberDeclarator(self, ctx: CPP14Parser.MemberDeclaratorContext):
...