You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
751 B
Racket
23 lines
751 B
Racket
#lang racket/base
|
|
|
|
#|
|
|
This grammar is permanently broken with the <elider> operator active.
|
|
|#
|
|
|
|
|
|
#|
|
|
|
|
|
|
## The following comes from: http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form
|
|
|
|
<syntax> : <rule> | <rule> <syntax>
|
|
<rule> : <opt-whitespace> "<" <RULE-NAME> ">" <opt-whitespace> "::="
|
|
<opt-whitespace> <expression> <line-end>
|
|
<opt-whitespace> : " " <opt-whitespace> | "" ## "" is empty string, i.e. no whitespace
|
|
<expression> : <list> | <list> "|" <expression>
|
|
<line-end> : <opt-whitespace> <EOL> | <line-end> <line-end>
|
|
<list> : <term> | <term> <opt-whitespace> <list>
|
|
<term> : <literal> | "<" <RULE-NAME> ">"
|
|
<literal> : '"' <TEXT> '"' | "'" <TEXT> "'" ## actually, the original BNF did not use quotes
|
|
|
|
|# |