v 0.4
...It starts to be slowly time for a repository. I guess it is the last time I put up code like this.
Anyway, now you've a nice parser to play with.
Instructions
> ghci Main.hs
To parse some code:
> main
To parse a syntax file:
> main_syn
Global process
- Write your own grammar corresponding to the 'Grammar' data type
- Call makeGrammarParser giving your grammar as input to obtain a parse function (at run time!)
- Apply this parse function to a stream to obtain the corresponding parse tree according to this grammar
Remarks
- defining syntax in bodies is now supported
- declarative syntax definition, very easy to change it
- no more tokenizer, scannerless
- spaces are important, they delimit the tokens
- things like "@%*!" are valid symbols (try it!)
- operator priority not taken into account because we expect that operators can be defined in the code, so it must be determined in a later step