(ocamllex
  (modules lexer)
)

; Compile tokens.mly into a definition of the type [token].
(menhir
  (modules tokens)
  (flags --only-tokens)
)

; Compile parser.mly into a (parameterized) parser.
; We need tokens.mly too, because it contains the token definitions.
; The resulting OCaml files should be named parser.{ml,mli}
; and should *not* contain a definition of the [token] type.
(menhir
  (modules tokens parser)
  (merge_into parser)
  (flags --external-tokens Tokens)
)

(executable
  (name calc)
)

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

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