A library with lexers and parsers for the Epilog programming language.
bun add epilog-lexers-parsers
Download the latest release. The library exports four main functions (for the imports to work, make sure to colocate the release file with your code):
import { datasetLexer, rulesetLexer } from "./epilog-lexers-parsers.js";
// Tokenize a dataset
const datasetTokens = datasetLexer("father(john, mary).");
// Returns array of tokens: [{type: "CONSTANT", content: "father"}, {type: "LEFT_PAREN"}, ...]
// Tokenize a ruleset
const rulesetTokens = rulesetLexer("ancestor(X, Y) :- parent(X, Y).");
// Returns array of tokens: [{type: "CONSTANT", content: "ancestor"}, {type: "LEFT_PAREN"}, ...]
import { parseDataset, parseRuleset } from "./epilog-lexers-parsers.js";
// Parse a dataset (requires tokens from datasetLexer)
const datasetAst = parseDataset(datasetTokens);
// Returns AST with type "DATASET" and children representing facts
// Parse a ruleset (requires tokens from rulesetLexer)
const rulesetAst = parseRuleset(rulesetTokens);
// Returns AST with type "RULESET" and children representing rules, operations, and definitions
- Bun runtime
- Git
# Clone the repository
git clone [repository-url]
cd epilog-lexers-parsers
# Install dependencies
bun install
bun test
To create a new release:
- Make sure all your changes are committed and pushed
- Create and push a new tag with semantic versioning:
git tag v1.0.0 # Replace with appropriate version git push origin v1.0.0
- The GitHub Action will automatically:
- Run all tests
- Build the project
- Create a new GitHub release
- Upload build artifacts
The release will be available in the GitHub repository's Releases section.
This is “work made for hire” within the meaning of the Copyright Act of 1976, as amended from time to time. The Software is the sole property of The Board of Trustees of the Leland Stanford Junior University. It was initially developed by Paul F. Welter (bayshore AI).