Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ParsingTable

Implementation of CLR(1) parsing table.

export
class

ParsingTable

implements

{IParsingTable}

Hierarchy

  • ParsingTable

Implements

Index

Constructors

constructor

  • Creates an instance of ParsingTable.

    memberof

    ParsingTable

    Parameters

    • grammer: CFG

      The CFG whose parsing table to construct

    Returns ParsingTable

Properties

ACTION

ACTION: ActionMap

GOTO

GOTO: GotoMap

grammer

grammer: CFG

The CFG used in parsing table.

type

{CFG}

memberof

ParsingTable

startState

startState: LRClosure

states

states: Array<LRClosure>

Methods

genGoto

  • genGoto(): void
  • Generates the GotoMap of the CFG.

    memberof

    ParsingTable

    Returns void

genParsingTable

  • genParsingTable(): void
  • Generates the parsing table of CFG

    memberof

    ParsingTable

    Returns void

Private getStateIfExists

  • Checks and returns the LRClosure for the kernel if already exists, creates new LRClosure if not.

    memberof

    ParsingTable

    Parameters

    Returns LRClosure | null

goto

  • The goto function of parsing table.

    Example: GOTO(I0, 'A') = I1

    throws

    {ReferenceError} If the symbol is not one of terminal or non terminal in the CFG.

    memberof

    ParsingTable

    Parameters

    • state: LRClosure

      The current state. I0

    • symbol: string

      The input symbol in the CFG. A

    Returns LRClosure | null

    The destination state. I1

Generated using TypeDoc