On this page:
production-expression?
group-expression?
group-expression
choice-expression?
choice-expression
repetition-expression?
repetition-expression
cut-expression?
cut-expression
grammar-symbol?
atom-symbol?
atom-symbol
punctuation-symbol?
punctuation-symbol
nonterminal-symbol?
nonterminal-symbol
8.12

3 Production expressions🔗ℹ

 (require yaragg/base/production-expression)
  package: yaragg

A production expression is a pattern of symbols and tokens in a grammar. Production expressions are used by production rules to describe what pattern of tokens a symbol corresponds to. Production expressions come in a few variants:

procedure

(production-expression? v)  boolean?

  v : any/c
A predicate for production expressions.

procedure

(group-expression? v)  boolean?

  v : any/c
A predicate for group expressions.

procedure

(group-expression subexpressions)  group-expression?

  subexpressions : (sequence/c production-expression?)
Constructs a group expression, which is a production expression that matches each expression in subexpressions one after the other in series. Every subexpression must match for the entire group expression to match.

procedure

(choice-expression? v)  boolean?

  v : any/c
A predicate for choice expressions.

Constructs a choice expression, which is a production expression that attempts each expression in choices on the input until one of them matches. At least one subexpression must match for the entire choice expression to match.

procedure

(repetition-expression? v)  boolean?

  v : any/c
A predicate for repetition expressions.

procedure

(repetition-expression subexpression 
  [#:min-count min-count 
  #:max-count max-count]) 
  repetition-expression?
  subexpression : (or/c production-expression? grammar-symbol?)
  min-count : exact-nonnegative-integer? = 0
  max-count : (or/c exact-nonnegative-integer? +inf.0) = +inf.0
Constructs a repetition expression, which is a production expression that attempts to match subexpression multiple times in series. The subexpression must match at least min-count times and at most max-count times.

procedure

(cut-expression? v)  boolean?

  v : any/c
A predicate for cut expressions.

procedure

(cut-expression subexpression)  cut-expression?

  subexpression : (or/c production-expression? grammar-symbol?)
Constructs a cut expression, which is a production expression that functions exactly like subexpression except the match is omitted from the resulting parse tree.

procedure

(grammar-symbol? v)  boolean?

  v : any/c
A predicate for grammar symbols, which are either terminal symbols or nonterminal symbols.

procedure

(atom-symbol? v)  boolean?

  v : any/c

procedure

(atom-symbol type)  atom-symbol?

  type : symbol?

procedure

(punctuation-symbol? v)  boolean?

  v : any/c

procedure

(punctuation-symbol str)  punctuation-symbol?

  str : string?

procedure

(nonterminal-symbol? v)  boolean?

  v : any/c

procedure

(nonterminal-symbol key)  nonterminal-symbol?

  key : any/c