All Questions
4 questions
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
...
2
votes
1
answer
1k
views
Antlr 4 in python not working as expected (trying to parse chapter and paragraph of a book)
I want to create a very simple ANTLR4 parser (in Python) without listener and visitor, which takes as input the chapter and paragraph of a book in any order, and returns the high_level (chapter) and ...
1
vote
1
answer
3k
views
Antlr4 - matching an identifier as a single token
BLOCK_COMMENT : '/*' .*? '*/' -> skip;
EOL_COMMENT : '//' ~[\r\n]* -> skip;
WS: [ \n\t\r]+ -> skip;
program: usingDirectives? EOF;
usingDirectives: usingDirective+;
usingDirective: USING
...
1
vote
1
answer
437
views
ANTLR4: parsing an email header, lookahead not working, Python target
I am trying to parse this portion of an email header:
Received: from server.mymailhost.com (mail.mymailhost.com [126.43.75.123]) by pilot01.cl.msu.edu (8.10.2/8.10.2) with ESMTP id NAA23597;Fri, 12 ...