An executable parser of PFCS.
If you are looking for API functions for calling the PFCS parser, please see parser-interface.
This is a fairly simple parser for the PFCS syntactic grammar. The parser consists of a collection of parsing functions that operate on a sequence of tokens. Most parsing functions take a lookahead token (an optional ABNF tree) and a sequence of the remaining tokens (list of ABNF trees).
Each ABNF tree in the sequence of tokens
(and the lookahead token) should have a rulename
from the right hand side of the ABNF rule for
token = identifier / integer / operator / separator
All the parsing functions return, as first result, an ABNF tree or list of trees that represents the parsed input. This is called a CST (Concrete Syntax Tree).
Almost all the parsing functions also return
the next unparsed token and the tokens that follow it.
That is, they prefetch the token, so it is ready for the next function.
If the end of the input is reached, the next token is