Skip to content

Data structures for symbols and symbol table to be used in compilers/interpreters. Written in TypeScript and can be used in TypeScript and JavaScript projects.

License

Notifications You must be signed in to change notification settings

solzacode/jsymbol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsymbol

Build Status NPM version Coverage Status

Data structures for symbols and symbol table to be used in compilers/interpreters. Written in TypeScript and can be used in TypeScript and JavaScript projects.

Installation

Using yarn

yarn add jsymbol

Using npm

npm install jsymbol --save

Usage

TypeScript

import { SymbolTable, AstSymbol } from "jsymbol";

let st: SymbolTable<AstSymbol> = new SymbolTable<AstSymbol>(s => s.identifier);
let sym: AstSymbol = new AstSymbol("counter", "variable");   // symbol and its type

st.add(sym);

st.enterScope();
// assert: st.lookup("counter") === sym;

st.exitScope();

JavaScript

const jsymbol = require("jsymbol");

let st = new jsymbol.SymbolTable(s => s.identifier);
let sym = new jsymbol.AstSymbol("counter", "variable");

st.add(sym);

st.enterScope();
// assert: st.lookup("counter") === sym;

st.exitScope();

About

Data structures for symbols and symbol table to be used in compilers/interpreters. Written in TypeScript and can be used in TypeScript and JavaScript projects.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors