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.
brag/brag-lib/brag/examples/bnf.rkt

14 lines
658 B
Racket

#lang brag
## 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