diff options
author | JSDurand <mmemmew@gmail.com> | 2022-01-21 21:53:50 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2022-01-21 21:53:50 +0800 |
commit | 53865aad225ffbe5cf3c42736e5a2095092f9fff (patch) | |
tree | 697ecbee7fa69ae8c58a0ec2f69cdf84d7cd313f /src/bnf.bnf | |
parent | 5730d6c04258e192195bfbbbed76d68fd78ed458 (diff) |
temporary save point
Just to save some work.
Diffstat (limited to 'src/bnf.bnf')
-rw-r--r-- | src/bnf.bnf | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/bnf.bnf b/src/bnf.bnf new file mode 100644 index 0000000..26e9861 --- /dev/null +++ b/src/bnf.bnf @@ -0,0 +1,62 @@ +# A grammar file for reading BNF notation + +[id]: a-zA-Z-_+*@ + +[notbracket]: ^[] + +[notnewline]: ^\n\r + +-- + +BNF: predicate_section "--\n" rules_section +BNF: rules_section +BNF: + +spaces: space spaces +spaces: + +space: " " +space: "\t" + +empty: spaces empty +empty: "\n" empty "\n" +empty: "\r" empty "\n" +empty: "#" notnewlines "\n" +empty: + +notnewlines: [notnewline] notnewlines +notnewlines: + +predicate_section: predicate empty "\n" empty predicate_section +predicate_section: + +predicate: "[" ids "]:" spaces class + +ids: [id] ids +ids: + +# Yes, a class specification can be empty, in which case the predicate +# is equivalent with the default "any" predicate. + +class: positive_class +class: "^" positive_class + +positive_class: positive_specification positive_class +positive_class: + +positive_specification: notnewline +positive_specification: notnewline "-" notnewline + +notnewline: [notnewline] +notnewline: "\\" [any] +notnewline: + +rules_section: rule empty "\n" empty rules_section + +rule: rule_name ":" spaces rule_rhs + +rule_name: [notbracket] rule_name +rule_name: + +rule_rhs: ids spaces rule_rhs +rule_rhs: |