symb2id: Convert a symbol to a numeric identifier.

View source: R/BNF.R

symb2idR Documentation

Convert a symbol to a numeric identifier.

Description

symb2id() converts a symbol to a numeric id.

Usage

symb2id(sym, ST)

Arguments

sym

A character string with the symbol, e.g. <fe> or "NOT".

ST

A symbol table.

Value

  • A positive integer if the symbol exists or

  • an empty integer (integer(0)) if the symbol does not exist.

See Also

Other Utility Functions: derive(), id2symb(), isNonTerminal(), isTerminal(), rules()

Examples

g<-compileBNF(booleanGrammar())
symb2id("<fe>", g$ST)
symb2id("NOT", g$ST)
symb2id("<fe", g$ST)
symb2id("NO", g$ST)
identical(symb2id("NO", g$ST), integer(0))


xegaBNF documentation built on May 29, 2024, 10:23 a.m.

Related to symb2id in xegaBNF...