tscc-compiler
Version:
An LALR(1) compiler compiler written in Typescript
18 lines (15 loc) • 434 B
text/typescript
import { TokenDef } from "../grammar/token-entry";
import { Position } from "../parser/node";
export interface CodeGenerator{
raw(s: string);
beginBlock(pos: Position, always: boolean);
endBlock(pos: Position);
pushLexState(n: number);
switchToLexState(n: number);
popLexState();
setImg(n: string);
tokenObj(); // $token
matched(); // $matched
lhs(); // $$
emitToken(tid: number);
};