v 0.4

parser_v_0.4.zip
Compressed Archive in ZIP Format 36.6 KB

 

...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

 

  1. Write your own grammar corresponding to the 'Grammar' data type
  2. Call makeGrammarParser giving your grammar as input to obtain a parse function (at run time!)
  3. 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