Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CFG

A representation context free grammer

export
class

CFG

Hierarchy

  • CFG

Index

Constructors

constructor

  • Creates an instance of CFG.

    memberof

    CFG

    Parameters

    Returns CFG

Properties

Private nonTerminals

nonTerminals: string[]

Set of non terminals

type

{string[]}

memberof

CFG

Private productions

productions: Production[]

Array of productions.

type

{Production[]}

memberof

CFG

Private startSymbol

startSymbol: string

Start Symbol

type

{string}

memberof

CFG

Private terminals

terminals: string[]

Set of terminals

type

{string[]}

memberof

CFG

Accessors

nonTerms

  • get nonTerms(): string[]
  • Get the set of non terminals of CFG.

    readonly
    type

    {string[]}

    memberof

    CFG

    Returns string[]

start

  • get start(): string
  • Get the starting symbol of CFG.

    readonly
    type

    {string}

    memberof

    CFG

    Returns string

terms

  • get terms(): string[]
  • Get the set of terminals of CFG.

    readonly
    type

    {string[]}

    memberof

    CFG

    Returns string[]

Methods

getAugmentedCFG

  • getAugmentedCFG(): CFG
  • Gets the augmented CFG for the given CFG.

    memberof

    CFG

    Returns CFG

getFirstOf

  • getFirstOf(word: string[]): string[]
  • Returns the FIRSTOF the word.

    memberof

    CFG

    Parameters

    • word: string[]

      Ordered set of symbols of CFG

    Returns string[]

getProduction

  • Gets all the productions for the symbol.

    memberof

    CFG

    Parameters

    • symbol: string

    Returns Production[]

isNonTerminal

  • isNonTerminal(symbol: string): boolean
  • Checks if the symbol is a non terminal of the CFG.

    memberof

    CFG

    Parameters

    • symbol: string

    Returns boolean

isTerminal

  • isTerminal(symbol: string): boolean
  • Checks if the symbol is a terminal of the CFG.

    memberof

    CFG

    Parameters

    • symbol: string

    Returns boolean

Generated using TypeDoc