rules: Returns all indices of rules applicable for a non-terminal...

View source: R/BNF.R

rulesR Documentation

Returns all indices of rules applicable for a non-terminal identifier.

Description

rules() finds all applicable production rules for a non-terminal identifier.

Usage

rules(Id, LHS)

Arguments

Id

A numerical identifier.

LHS

The left-hand side of a production table.

Value

  • A vector of indices of all applicable rules in the production table or

  • an empty integer (integer(0)), if the numerical identifier is not found in the left-hand side of the production table.

See Also

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

Examples

a<-booleanGrammar()$BNF
ST<-makeSymbolTable(a)
PT<-makeProductionTable(a,ST)
rules(5, PT$LHS)
rules(8, PT$LHS)
rules(9, PT$LHS)
rules(1, PT$LHS)


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

Related to rules in xegaBNF...