pegjs-prolog-parser
v1.1.2
Published
Prolog parser using PEGjs
Downloads
3
Readme
PEGjs Prolog Parser
Description
Supports a function called parse
which takes in a Prolog
string and returns an AST from it.
The AST returned is an ASTNode from the asty npm module.
Usage
const parser = require('pegjs-prolog-parser');
const clause = "script(X).";
const result = parser.parse(clause);
console.log(result.dump());
// Result:
//
// Prolog [1,1]
// └── Compound [1,1]
// ├── Functor (value: "script") [1,1]
// └── Arguments [1,8]
// └── Variable (value: "X") [1,8]