Javascript is not support _input grammar ?

60 views
Skip to first unread message

周浩

unread,
May 28, 2018, 11:03:53 PM5/28/18
to antlr-discussion
 Javascript is not support _input grammar ?


const { FileStream, CommonTokenStream, InputStream } = require("antlr4/index");
const { ParseTreeWalker } = require("antlr4/tree");
const { HplsqlLexer } = require("./parser/HplsqlLexer");
const { HplsqlListener } = require("./parser/HplsqlListener");
const { HplsqlParser } = require("./parser/HplsqlParser");
const { HplsqlVisitor } = require("./parser/HplsqlVisitor");
const { Loader } = require("./loader/loader");

const str = `select a from b;`;
const chars = new InputStream(str);
const lexer = new HplsqlLexer(chars);
const tokens = new CommonTokenStream(lexer);
const parser = new HplsqlParser(tokens);
parser.buildParseTrees = true;
const tree = parser.program();


The code throw error

internal/modules/cjs/loader.js:573
    throw err;
    ^

Error: Cannot find module '/Users/lleohao/Projects/Temp/antlr/javascript/src/parser/index.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)
    at Function.Module._load (internal/modules/cjs/loader.js:497:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:719:10)
    at startup (internal/bootstrap/node.js:228:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:576:3)




周浩

unread,
Jun 23, 2018, 2:38:46 AM6/23/18
to antlr-discussion
 This is my mistake. I have fixed it. 
Reply all
Reply to author
Forward
0 new messages