JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 578
  • Score
    100M100P100Q93196F
  • License MIT

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.

Package Exports

  • jsymbol

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jsymbol) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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();