You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { ANTLRInputStream, CommonTokenStream } from 'antlr4ts';
// Create the lexer and parser
let inputStream = new ANTLRInputStream("text");
let lexer = new MyGrammarLexer(inputStream);
let tokenStream = new CommonTokenStream(lexer);
let parser = new MyGrammarParser(tokenStream);
// Parse the input, where `compilationUnit` is whatever entry point you defined
let tree = parser.compilationUnit();
every thing is ok but the last one. I got TS2339: Property 'compilationUnit' does not exist on type 'Python3Parser'.
The text was updated successfully, but these errors were encountered:
the 'compilationUnit' isnt related to antlr itself, its vary based on your grammar
import{CharStreams,CommonTokenStream,ParserRuleContext}from'antlr4ts';import{ParseTreeWalker}from'antlr4ts/tree/ParseTreeWalker';import{ExprContext,calcParser}from'./generated/calcParser';import{calcListener}from'./generated/calcListener';import{calcLexer}from'./generated/calcLexer';import*asfsfrom"fs";// Create the lexer and parserconstcode=fs.readFileSync('EXAMPLE.txt','utf8');constinputStream=CharStreams.fromString(code);constlexer=newcalcLexer(inputStream);consttokenStream=newCommonTokenStream(lexer);constparser=newcalcParser(tokenStream);consttree=parser.program();
in my case my entrypoint parser is "program" method, the grammar used is the AntlrLab Sample
I'm trying to follow the readme with python3.g4.
every thing is ok but the last one. I got TS2339: Property 'compilationUnit' does not exist on type 'Python3Parser'.
The text was updated successfully, but these errors were encountered: