Here is the formal grammar for Fexl. You may also find it helpful to see the sample code here.
exp => empty exp => term exp exp => ; exp exp => \ sym def exp term => sym term => ( exp ) def => empty def => is term is => = is => == sym => name sym => string string => simple_string string => complex_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, tidle, or pound. If a name after a \ contains an equal sign, it must be set off with white space to avoid ambiguity. For example, to define a function named "=", you can say "\ = = X" but not "\==X".
A simple_string is a string of characters enclosed in double quotes, e.g. "hello world". The string itself may not contain double quotes.
A complex_string is a string of characters enclosed in an arbitrary delimiter starting with tidle, e.g. ~| This has both " and ~ in it.~|. The string may contain any characters whatsoever, including NUL.
2011-12-13