Commit cd88d673 authored by POTTIER Francois's avatar POTTIER Francois

Add a new test.

parent 366d10c5
Grammar has 1 nonterminal symbols, among which 1 start symbols.
Grammar has 1 terminal symbols.
Grammar has 1 productions.
nullable(main) = false
first(main) = EOF
follow(main) = #
Built an LR(0) automaton with 3 states.
The grammar is SLR(1).
Built an LR(1) automaton with 3 states.
2 out of 3 states have a default reduction.
0 out of 3 states are represented.
0 out of 5 symbols keep track of their start position.
0 out of 5 symbols keep track of their end position.
2 out of 2 productions exploit shiftreduce optimization.
0 out of 3 states can peek at an error.
15 functions before inlining, 1 functions after inlining.
(* This grammar tests whether %inline affects the order in which
semantic actions are executed. *)
(* If neither [a] nor [b] are marked %inline, then this program
should print "Reducing A" followed with "Reducing B". *)
(* If [a] is marked %inline and [b] is not, then this program
should print "Reducing B" followed with "Reducing A". This is
unavoidable -- it follows from the meaning of %inline. *)
(* Similarly, if [b] is marked %inline and [a] is not,
then there is no choice. *)
(* If both [a] and [b] are marked %inline, however,
then the behavior of this program is unspecified.
As of 2018/09/18, the order is indeed reversed:
this program prints "Reducing B" first. *)
%start<unit> main
%token EOF
%%
main:
a b EOF {}
%inline a:
{ Printf.printf "Reducing A\n%!" }
%inline b:
{ Printf.printf "Reducing B\n%!" }
%%
let () =
let dummy = Lexing.from_string "" in
main (fun _lexbuf -> EOF) dummy
(*
menhir inliningWithSideEffects.mly
/usr/bin/env ocaml inliningWithSideEffects.ml
*)
%start main
%token EOF
%type <unit> main
%%
main:
_3 = EOF
{let _2 =
( Printf.printf "Reducing B\n%!" )
in
let _1 =
( Printf.printf "Reducing A\n%!" )
in
()}
%%
let () =
let dummy = Lexing.from_string "" in
main (fun _lexbuf -> EOF) dummy
(*
menhir inliningWithSideEffects.mly
/usr/bin/env ocaml inliningWithSideEffects.ml
*)
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