Commit 3aba1f44 authored by POTTIER Francois's avatar POTTIER Francois

More input tests for the reference interpreter.

parent bef92ceb
......@@ -11,5 +11,5 @@ parser.mli
*.table.err
*.code.out
*.code.err
interpret.out
interpret.err
*.interpret.out
*.interpret.err
INT PLUS INT TIMES INT PLUS INT EOL
Lookahead token is now INT (-1--1)
State 0:
Shifting (INT) to state 4
State 4:
Lookahead token is now PLUS (-1--1)
Reducing production expr -> INT
State 22:
Shifting (PLUS) to state 11
State 11:
Lookahead token is now INT (-1--1)
Reducing production optional_dot ->
State 12:
Shifting (INT) to state 4
State 4:
Lookahead token is now TIMES (-1--1)
Reducing production expr -> INT
State 13:
Shifting (TIMES) to state 6
State 6:
Lookahead token is now INT (-1--1)
Reducing production optional_dot ->
State 8:
Shifting (INT) to state 4
State 4:
Lookahead token is now PLUS (-1--1)
Reducing production expr -> INT
State 9:
Reducing production expr -> expr TIMES optional_dot expr
State 13:
Reducing production expr -> expr PLUS optional_dot expr
State 22:
Shifting (PLUS) to state 11
State 11:
Lookahead token is now INT (-1--1)
Reducing production optional_dot ->
State 12:
Shifting (INT) to state 4
State 4:
Lookahead token is now EOL (-1--1)
Reducing production expr -> INT
State 13:
Reducing production expr -> expr PLUS optional_dot expr
State 22:
Shifting (EOL) to state 23
State 23:
Reducing production main -> expr EOL
State 21:
Accepting
LPAREN INT PLUS INT RPAREN TIMES INT PLUS INT EOL
Lookahead token is now LPAREN (-1--1)
State 0:
Shifting (LPAREN) to state 2
State 2:
Lookahead token is now INT (-1--1)
Reducing production nothing ->
State 3:
Shifting (INT) to state 4
State 4:
Lookahead token is now PLUS (-1--1)
Reducing production expr -> INT
State 5:
Shifting (PLUS) to state 11
State 11:
Lookahead token is now INT (-1--1)
Reducing production optional_dot ->
State 12:
Shifting (INT) to state 4
State 4:
Lookahead token is now RPAREN (-1--1)
Reducing production expr -> INT
State 13:
Reducing production expr -> expr PLUS optional_dot expr
State 5:
Shifting (RPAREN) to state 10
State 10:
Lookahead token is now TIMES (-1--1)
Reducing production expr -> LPAREN nothing expr RPAREN
State 22:
Shifting (TIMES) to state 6
State 6:
Lookahead token is now INT (-1--1)
Reducing production optional_dot ->
State 8:
Shifting (INT) to state 4
State 4:
Lookahead token is now PLUS (-1--1)
Reducing production expr -> INT
State 9:
Reducing production expr -> expr TIMES optional_dot expr
State 22:
Shifting (PLUS) to state 11
State 11:
Lookahead token is now INT (-1--1)
Reducing production optional_dot ->
State 12:
Shifting (INT) to state 4
State 4:
Lookahead token is now EOL (-1--1)
Reducing production expr -> INT
State 13:
Reducing production expr -> expr PLUS optional_dot expr
State 22:
Shifting (EOL) to state 23
State 23:
Reducing production main -> expr EOL
State 21:
Accepting
LPAREN INT PLUS INT RPAREN TIMES INT PLUS LPAREN INT TIMES MINUS INT RPAREN MINUS INT MINUS INT EOL
Lookahead token is now LPAREN (-1--1)
State 0:
Shifting (LPAREN) to state 2
State 2:
Lookahead token is now INT (-1--1)
Reducing production nothing ->
State 3:
Shifting (INT) to state 4
State 4:
Lookahead token is now PLUS (-1--1)
Reducing production expr -> INT
State 5:
Shifting (PLUS) to state 11
State 11:
Lookahead token is now INT (-1--1)
Reducing production optional_dot ->
State 12:
Shifting (INT) to state 4
State 4:
Lookahead token is now RPAREN (-1--1)
Reducing production expr -> INT
State 13:
Reducing production expr -> expr PLUS optional_dot expr
State 5:
Shifting (RPAREN) to state 10
State 10:
Lookahead token is now TIMES (-1--1)
Reducing production expr -> LPAREN nothing expr RPAREN
State 22:
Shifting (TIMES) to state 6
State 6:
Lookahead token is now INT (-1--1)
Reducing production optional_dot ->
State 8:
Shifting (INT) to state 4
State 4:
Lookahead token is now PLUS (-1--1)
Reducing production expr -> INT
State 9:
Reducing production expr -> expr TIMES optional_dot expr
State 22:
Shifting (PLUS) to state 11
State 11:
Lookahead token is now LPAREN (-1--1)
Reducing production optional_dot ->
State 12:
Shifting (LPAREN) to state 2
State 2:
Lookahead token is now INT (-1--1)
Reducing production nothing ->
State 3:
Shifting (INT) to state 4
State 4:
Lookahead token is now TIMES (-1--1)
Reducing production expr -> INT
State 5:
Shifting (TIMES) to state 6
State 6:
Lookahead token is now MINUS (-1--1)
Reducing production optional_dot ->
State 8:
Shifting (MINUS) to state 1
State 1:
Lookahead token is now INT (-1--1)
Shifting (INT) to state 4
State 4:
Lookahead token is now RPAREN (-1--1)
Reducing production expr -> INT
State 20:
Reducing production expr -> MINUS expr
State 9:
Reducing production expr -> expr TIMES optional_dot expr
State 5:
Shifting (RPAREN) to state 10
State 10:
Lookahead token is now MINUS (-1--1)
Reducing production expr -> LPAREN nothing expr RPAREN
State 13:
Reducing production expr -> expr PLUS optional_dot expr
State 22:
Shifting (MINUS) to state 17
State 17:
Lookahead token is now INT (-1--1)
Reducing production optional_dot ->
State 18:
Shifting (INT) to state 4
State 4:
Lookahead token is now MINUS (-1--1)
Reducing production expr -> INT
State 19:
Reducing production expr -> expr MINUS optional_dot expr
State 22:
Shifting (MINUS) to state 17
State 17:
Lookahead token is now INT (-1--1)
Reducing production optional_dot ->
State 18:
Shifting (INT) to state 4
State 4:
Lookahead token is now EOL (-1--1)
Reducing production expr -> INT
State 19:
Reducing production expr -> expr MINUS optional_dot expr
State 22:
Shifting (EOL) to state 23
State 23:
Reducing production main -> expr EOL
State 21:
Accepting
LPAREN INT PLUS DOT INT RPAREN TIMES INT PLUS LPAREN INT TIMES MINUS INT RPAREN MINUS DOT INT MINUS INT EOL
Lookahead token is now LPAREN (-1--1)
State 0:
Shifting (LPAREN) to state 2
State 2:
Lookahead token is now INT (-1--1)
Reducing production nothing ->
State 3:
Shifting (INT) to state 4
State 4:
Lookahead token is now PLUS (-1--1)
Reducing production expr -> INT
State 5:
Shifting (PLUS) to state 11
State 11:
Lookahead token is now DOT (-1--1)
Shifting (DOT) to state 7
State 7:
Lookahead token is now INT (-1--1)
Reducing production optional_dot -> DOT
State 12:
Shifting (INT) to state 4
State 4:
Lookahead token is now RPAREN (-1--1)
Reducing production expr -> INT
State 13:
Reducing production expr -> expr PLUS optional_dot expr
State 5:
Shifting (RPAREN) to state 10
State 10:
Lookahead token is now TIMES (-1--1)
Reducing production expr -> LPAREN nothing expr RPAREN
State 22:
Shifting (TIMES) to state 6
State 6:
Lookahead token is now INT (-1--1)
Reducing production optional_dot ->
State 8:
Shifting (INT) to state 4
State 4:
Lookahead token is now PLUS (-1--1)
Reducing production expr -> INT
State 9:
Reducing production expr -> expr TIMES optional_dot expr
State 22:
Shifting (PLUS) to state 11
State 11:
Lookahead token is now LPAREN (-1--1)
Reducing production optional_dot ->
State 12:
Shifting (LPAREN) to state 2
State 2:
Lookahead token is now INT (-1--1)
Reducing production nothing ->
State 3:
Shifting (INT) to state 4
State 4:
Lookahead token is now TIMES (-1--1)
Reducing production expr -> INT
State 5:
Shifting (TIMES) to state 6
State 6:
Lookahead token is now MINUS (-1--1)
Reducing production optional_dot ->
State 8:
Shifting (MINUS) to state 1
State 1:
Lookahead token is now INT (-1--1)
Shifting (INT) to state 4
State 4:
Lookahead token is now RPAREN (-1--1)
Reducing production expr -> INT
State 20:
Reducing production expr -> MINUS expr
State 9:
Reducing production expr -> expr TIMES optional_dot expr
State 5:
Shifting (RPAREN) to state 10
State 10:
Lookahead token is now MINUS (-1--1)
Reducing production expr -> LPAREN nothing expr RPAREN
State 13:
Reducing production expr -> expr PLUS optional_dot expr
State 22:
Shifting (MINUS) to state 17
State 17:
Lookahead token is now DOT (-1--1)
Shifting (DOT) to state 7
State 7:
Lookahead token is now INT (-1--1)
Reducing production optional_dot -> DOT
State 18:
Shifting (INT) to state 4
State 4:
Lookahead token is now MINUS (-1--1)
Reducing production expr -> INT
State 19:
Reducing production expr -> expr MINUS optional_dot expr
State 22:
Shifting (MINUS) to state 17
State 17:
Lookahead token is now INT (-1--1)
Reducing production optional_dot ->
State 18:
Shifting (INT) to state 4
State 4:
Lookahead token is now EOL (-1--1)
Reducing production expr -> INT
State 19:
Reducing production expr -> expr MINUS optional_dot expr
State 22:
Shifting (EOL) to state 23
State 23:
Reducing production main -> expr EOL
State 21:
Accepting
......@@ -29,7 +29,10 @@ done
# Run the reference interpreter.
echo "Running the reference interpreter..."
echo "INT PLUS INT TIMES INT PLUS INT EOL" | $MENHIR --trace --interpret parser.mly > interpret.out 2> interpret.err
for f in *.ideal.in ; do
b=${f%.in}
$MENHIR --trace --interpret parser.mly < $f > $b.interpret.out 2> $b.interpret.err
done
echo "Comparing results..."
......@@ -54,16 +57,21 @@ for f in *.real.in ; do
done
# Check the results of the reference interpreter.
if ! diff -q interpret-ref.out interpret.out >/dev/null ; then
echo "The reference interpreter produces a wrong result!"
echo "Expected:"
cat interpret-ref.out
echo "Got:"
cat interpret.out
fi
if ! diff -q interpret-ref.err interpret.err >/dev/null ; then
echo "The reference interpreter produces a wrong trace!"
diff interpret-ref.err interpret.err
fi
for f in *.ideal.in ; do
b=${f%.in}
echo "($b) Checking output of reference interpreter..."
if ! diff -q $b.ref.out $b.interpret.out >/dev/null ; then
echo "The reference interpreter produces a wrong result!"
echo "Expected:"
cat $b.ref.out
echo "Got:"
cat $b.interpret.out
fi
echo "($b) Checking trace of reference interpreter..."
if ! diff -q $b.ref.err $b.interpret.err >/dev/null ; then
echo "The reference interpreter produces a wrong trace!"
diff $b.ref.err $b.interpret.err
fi
done
echo "Done."
......@@ -19,7 +19,10 @@ for f in *.real.in ; do
done
# Run the reference interpreter.
echo "Running the reference interpreter..."
echo "INT PLUS INT TIMES INT PLUS INT EOL" | $MENHIR --trace --interpret parser.mly > interpret-ref.out 2> interpret-ref.err
for f in *.ideal.in ; do
b=${f%.in}
echo "($b) Reconstructing reference output and trace..."
$MENHIR --trace --interpret parser.mly < $f > $b.ref.out 2> $b.ref.err
done
echo "Done."
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