Skip to content

Instantly share code, notes, and snippets.

@tspspi
Created February 27, 2021 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tspspi/24d42e8e3ce78d9c0b61fe49c45512bd to your computer and use it in GitHub Desktop.
Save tspspi/24d42e8e3ce78d9c0b61fe49c45512bd to your computer and use it in GitHub Desktop.
ISO EBNF productions describing ISO EBNF without alternative syntax
(*
ISO EBNF Syntax
Removed alternative syntax:
definition separator symbol = ´|´ | ´/´ | ´!´;
start option symbol = ´[´ | ´(/´;
end option symbol = ´]´ | ´/)´;
start repeat symbol = ´{´ | ´(:´;
end repeat symbol = ´}´ | ´:)´;
*)
repetition symbol = ´*´;
except symbol = ´-´;
concatenate symbol = ´,´;
definition separator symbol = ´|´;
defining symbol = ´=´;
terminator symbol = ´;´ | ´.´;
first quote symbol = "´";
second quote symbol = ´"´;
start group symbol = ´(´;
end group symbol = ´)´;
start option symbol = ´[´;
end option symbol = ´]´;
start repeat symbol = ´{´;
end repeat symbol = ´}´;
special sequence symbol = ´?´;
terminal character = letter |
decimal digit |
concatenate symbol |
defining symbol |
definition separator symbol |
end group symbol |
end option symbol |
end repeat symbol |
except symbol |
first quote symbol |
repetition symbol |
second quote symbol |
special sequence symbol |
start group symbol |
start option symbol |
start repeat symbol |
terminator symbol |
other character;
other character = " " | "." | ":" | "!" | "+" | "_" | "%" | "@" | "&" | "#" | "$" | "<" | ">" | "/" | "\" | "^" | "`" | "~";
decimal digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
letter = ´a´ | ´b´ | ´c´ | ´d´ | ´e´ | ´f´ | ´g´ | ´h´ | ´i´ | ´j´ | ´k´ | ´l´ | ´m´ | ´n´ | ´o´ | ´p´ | ´q´ | ´r´ | ´s´ | ´t´ | ´u´ | ´v´ | ´w´ | ´x´ | ´y´ | ´z´ | ´A´ | ´B´ | ´C´ | ´D´ | ´E´ | ´F´ | ´G´ | ´H´ | ´I´ | ´J´ | ´K´ | ´L´ | ´M´ | ´N´ | ´O´ | ´P´ | ´Q´ | ´R´ | ´S´ | ´T´ | ´U´ | ´V´ | ´W´ | ´X´ | ´Y´ | ´Z´;
syntax = syntax rule, { syntax rule };
syntax rule = meta identifier, defining symbol, definitions list, terminator symbol;
definitions list = single definition, { definition separator symbol, single definition };
single definition = syntactic term, { concatenate symbol, syntactic term };
syntactic term = syntactic factor, [ except symbol, [ syntactic exception ] ];
syntactic exception = syntactic factor;
syntactic factor = syntactic factor repeatedfactor | syntactic primary;
syntactic factor repeatedfactor = integer, repetition symbol, syntactic primary;
integer = decimal digit, { decimal digit };
syntactic primary = optional sequence |
repeated sequence |
grouped sequence |
meta identifier |
terminal string |
special sequence |
empty sequence;
optional sequence = start option symbol, definitions list, end option symbol;
repeated sequence = start repeat symbol, definitions list, end repeat symbol;
grouped sequence = start group symbol, definitions list, end group symbol;
meta identifier = letter, { meta identifier character };
meta identifier character = letter | decimal digit;
terminal string = first quote symbol, terminal string first, first quote symbol | second quote symbol, terminal string second, second quote symbol;
terminal string first = first terminal character, { first terminal character };
terminal string second = second terminal character, { second terminal character };
first terminal character = terminal character - first quote symbol;
second terminal character = terminal character - second quote symbol;
special sequence = special sequence symbol, special sequence value, special sequence symbol;
special sequence value = { special sequence character };
special sequence character = terminal character - special sequence symbol;
empty sequence = ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment