Bidoche
24th November 2002, 16:39
In attachement, the first version of a parser.
Currently it only handles expressions made of int, float and bool literals (with no size limit)
operations +, -, *, /, % allowed for int and floats and all the comparison operator
operations !, &&, || ( b && b || b interdit) for booleans and ==, !=
construction b ? e1 : e2 allowed if e1 and e2 of same type
the parser correctly recognize as float an expression than contains a float literal at any point
ie 1/2 -> int:0
but 1/2 + .5 -> float:1.0
Source is included (Do yourself a favor and don't look into parser and tokenizer code, rather get cppcc documentation and look into the grammar)
Edit:
NB: This is a debug version who will trace the parsing processus
Currently it only handles expressions made of int, float and bool literals (with no size limit)
operations +, -, *, /, % allowed for int and floats and all the comparison operator
operations !, &&, || ( b && b || b interdit) for booleans and ==, !=
construction b ? e1 : e2 allowed if e1 and e2 of same type
the parser correctly recognize as float an expression than contains a float literal at any point
ie 1/2 -> int:0
but 1/2 + .5 -> float:1.0
Source is included (Do yourself a favor and don't look into parser and tokenizer code, rather get cppcc documentation and look into the grammar)
Edit:
NB: This is a debug version who will trace the parsing processus