formal-language/grammar Home Manual Reference Source

References

ast

summary
public
private

F async _children_exhaust(children: Iterator)

Exhausts the input children iterator.

public

F async * flatten(root: *)

public

F map(callable: Function, children: AsyncIterable): AsyncIterable

Applies a given callable to each of the child of a given children async iterable.

public

F async materialize(root: *): *

public

F async * rmap(callable: Function, rule: Iterable): AsyncIterator

Applies a given callable to each part of a given grammar rule (given as an iterable).

public

F async transform(tree: *, match: *, ctx: *): *

error

summary
public
public
public

grammar

summary
public
private

F * _expandproduction(production: *)

public

F alphabet(productions: *): *

public

F expandobject(object: *): *

public

F from(object: *): *

public

V EW: string

ll1

summary
public

C Parser

private

F async _children_next_lazy(eof: Object, productions: Map, table: Map, tape: Tape, expected: Object): Promise<object>

Get next child of table-driven predictive lazy parsing.

private

F * _compile(productions: Map): Iterable

Generates the rows of the predictive parsing table for a grammar.

private

F _follow(FIRST: Map, productions: Map): Map

Computes the FOLLOW table for all nonterminals.

private

F _parse_lazy(eof: Object, productions: Map, table: Map, rule: Array, tape: Tape, nonterminal: String, production: String): Object

Table-driven predictive lazy parsing.

public

F * audit(grammar: Grammar): IterableIterator<any>

List all reasons why a given grammar is not ll(1).

public

F compile(productions: Map): Map

Compiles the predictive parsing table for a grammar.

public

F follow(FOLLOW: Map, rule: Array): Set

Generate FOLLOW set for any rule given the FOLLOW sets for the nonterminals.

public

F from(grammar: *): *

public

F is(grammar: Grammar): Boolean

Check if grammar is ll(1).

public

F parse(root: *, start: *, eof: *, productions: *, table: *, tape: *): Object

Parse

util

summary
public

F anyIterator(object: *): *

public

F setadd(set: Set<any>, element: any): boolean

Adds an element to a set and returns true if the set has changed.

public

F setaddall(set: Set<any>, iterable: Iterable<any>): boolean

Adds all elements of an iterable to a set and returns true if the set has changed.

Directories