Commit ff766d4d authored by Julien Lopez's avatar Julien Lopez
Browse files

[TESTS][EVAL] Add a rather complete test for the parser; TODO added;

	GRAMMAR updated
parent 6a9bf556
(* TODO: Update this grammar if needed.
Formaly add comments. *)
expr = id
| integer
| expr expr
| abstr
| "(" expr "," expr ")"
| expr "." expr
| expr "," expr
| "(" expr ")"
| "match" expr "with" "|" expr ["&" type_id] "->" expr branches
abstr = "fun" id params "=" expr
......
Syntax:
- "_" as a keyword (?)
Externals:
- Compile the externals to the parser
Tests:
- Update tests to check the evaluation of CDuce (depends on externals)
Original: fun firsts x y -> match x,y with
| (a,_),(b,_) -> a,b (* This (* is (* a nested *) *) comment *)
| _ -> x.3 (* That doesn't make any sense *)
Expr: Abstract(firsts x y, Match(Pair(Var(x), Var(y)), (Pair(Pair(Var(a), Var(_)), Pair(Var(b), Var(_))), Pair(Var(a), Var(b)))(Var(_), Apply(Var(x), Int(3)))))
Result: fun firsts x y -> match (x, y) with
| ((a, _), (b, _)) -> (a, b)
| _ -> x . 3
0
\ No newline at end of file
fun firsts x y -> match x,y with
| (a,_),(b,_) -> a,b (* This (* is (* a nested *) *) comment *)
| _ -> x.3 (* That doesn't make any sense *)
......@@ -2,7 +2,7 @@
ROOT="."
BIN=$ROOT/`grep OUT $ROOT/Makefile | head -1 | cut -d '=' -f 2 | tr -d ' '`
MODULES="$ROOT/tests/lexer"
MODULES="$ROOT/tests/lexer $ROOT/tests/parser"
OUT=__out__
DIFF=__diff__
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment