Fexl Grammar

exp     =>  empty
exp     =>  exp factor

factor  =>  "\;" exp
factor  =>  "\=" exp
factor  =>  "\" name def exp
factor  =>  "\\" name def exp
factor  =>  ";" exp
factor  =>  term

def     =>  empty
def     =>  "=" term

term    =>  "(" exp ")"
term    =>  "[" items "]"
term    =>  "{" items "}"
term    =>  string
term    =>  name

items   =>  empty
items   =>  term items
items   =>  ";" exp

string  =>  quote_string
string  =>  tilde_string

The parser reads an expression from the input until it reaches end of file or the special token "\#" which acts like end of file. It skips white space and comments which appear before syntactic elements. White space is any character with an ASCII value less than or equal to ' ' (SPACE). A comment starts with '#' and continues through end of line.

The empty element means end of file.

name

A name is any sequence of characters other than white space or these:
\ ( ) [ ] { } ; " ~ # =

quote_string

A quote_string starts with a '"' (QU), followed by any sequence of characters other than QU, followed by a closing QU. Here are some examples:
""

"hello world"

"This is a multi-
line string."

tilde_string

A tilde_string is a sequence of arbitrary characters enclosed within a pair of delimiters of your choice. It starts with a delimiter, which is a '~' (tilde), then zero or more non white characters, then a single white space which ends the delimiter and is ignored. That initial delimiter is followed by a sequence of characters which constitute the actual content of the string, terminated by a repeat occurrence of the delimiter. Here are some examples:
~ This has "quotes" in it.~

~| This has "quotes" in it.~|

~END
Anyone familiar with "here is" documents
should easily understand the rule.
~END

~~
Usually just a single tilde "~" will suffice as a delimiter, or if the string
contains a tilde like this one, then a double tilde will suffice.
~~

2023-06-15