;; ------------------------------------------------------------------------------
;; The following declarations are used to build this demo.

(ocamllex
  (modules lexer)
)

(menhir
  (modules parser)
  (flags --table --inspection -v -la 2 --comment)
)

(executable
   (name calc)
   (libraries menhirLib)
)

;; ------------------------------------------------------------------------------
;; The following declarations are used to test this demo.

(rule
  (with-stdout-to calc.out
  (with-stdin-from calc.in
    (run ./calc.exe)
  ))
)

(rule
  (alias test)
  (action (diff calc.exp calc.out))
)

(rule
  (with-stderr-to err1.out
  (with-stdin-from err1.in
    (run ./calc.exe)
  ))
)

(rule
  (alias test)
  (action (diff err1.exp err1.out))
)

(rule
  (with-stderr-to err2.out
  (with-stdin-from err2.in
    (run ./calc.exe)
 ))
)

(rule
  (alias test)
  (action (diff err2.exp err2.out))
)

;; ------------------------------------------------------------------------------
;; The following declarations are not part of the demo.
;; They are used to test Menhir itself.
;; Any change in the code generated by Menhir's table back-end is detected here.

(rule
  (alias test)
  (action (diff parser.ml.exp parser.ml))
)

(rule
  (alias test)
  (action (diff parser.mli.exp parser.mli))
)
