I have created a Datalog parser using Antlr. I am not sure how to proceed. I want to generate the AST
Antlr has generated the following files:
Lexer.py
Listener.py
Lexer.tokens
Parser.py
Program.tokens
I have gone through the tutorial. I couldn't understand it. How do I test my input in Python:
a(X): b(X)
I want to generate the AST so that I could use it my Query Processing engine.
So I have figured out, I am writing code to generate the AST.
import sys
import antlr4
from antlr4 import *
from NLexer import *
from NParser import *
from NListener import *
char_stream = InputStream('a(1)\n')
lexer = NLexer(char_stream )
stream = CommonTokenStream(lexer)
parser = NParser(stream)
tree = parser.XXX() . // This is where I am confused. How do I generate
tree. What function should be called here
instead of XXX?