On Wednesday, 16 September 2015 at 20:17:15 UTC, Stefan Koch
On Monday, 14 September 2015 at 08:50:48 UTC, Bastiaan Veelo
Understanding the source of FancyPars is challenging because
the core source, example vibe.d application source and
supporting code, as well as generated lexer/parser code are
all contained in the same directory and committed in the
Sorry about that.
The Files that are really interesting are
1. fancy_grammar.d - contains helpers for working with the
2. fancy_genPars.d - generates a function which parses the
output form the generated lexer
3. fancy_genLex.d generates the lexer function.
4. fancy_genAST.d - generates the AST
Thanks. At first I thought that
fancy_[ast|token|lexer|parser|printer].d were generated files
because their content is so similar to the code produced in the
vibe application. But on closer look I think it is the other way
around: that the example grammar in vibe describes its own input
format, and that the similarity in the produced output to said
files is an illustration that it works the way it should. Am I
The Syntax is inspired by D and Pegged.
It is going to be extend though and you should consider it
I will document it as it becomes more stable.
Wow that is great news! Not so abandoned after all :-)
TransCompilers are what fancyPars is written for.
please show me a few examples of your pascal gramamr.
might be in pegged or EBNF or something similar.
So I can see if there are idioms I should integrate in fp.
Please have a look in
p2d.d is my dance with Pegged, containing a subset of the
Extended Pascal grammar. It was only after typing close to 400
lines of grammar that I discovered left-recursions, which are
commented out. These put a spanner in the works, but before that
I felt this could go somewhere: even comments are translated.
There are many recursions in the complete grammar, for which you
find the specification in the PDF. (This is the ANSI/IEEE
standard; Extended Pascal became an ISO standard a year or so
later, with identical text.) Note the alphabetical list of EBNF
starting on page 129; the numbers in front refer to the
Thanks for the interest.
Thanks for finding the time for this.