Here is a somewhat formal grammar for Fexl.
exp => empty exp => term exp exp => ; exp exp => \ name exp exp => \ name = term exp exp => \ name == term exp exp => \; exp exp => \= exp term => ( exp ) term => [ items ] term => { items } term => name term => string items => empty items => term items items => ; exp string => quote_string string => tilde_string
The Fexl parser reads an expression from the input until it reaches EOF (end of file) or the special token "\\". The \\ token stops the parser immediately, as if it had reached end of file.
Any time a pound sign appears outside a string, the parser ignores the remainder of the line, treating it as a comment.
A name is any sequence of characters except for white space, NUL, backslash, left or right parentheses, semicolon, double quote, tilde, pound, or equal sign.
A string value is any sequence of zero or more arbitrary characters (NUL is allowed). There are two ways of including string values in a Fexl program.
A quote_string is a string value enclosed within a pair of double quotes. A double quote cannot appear within the string value. Here are some examples:
"" "hello world" "This is a multi- line string."
A tilde_string is a string value enclosed within a pair of delimiters of your own choice. It starts with a tilde (~), then zero or more non white-space characters, then a single white-space character which ends the delimiter and is ignored. This is followed by an arbitrary series of characters which constitute the actual content of the string, and finally a repeat occurrence of the original delimiter including the tilde.
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. ~~
2016-07-29