Commit a01e0cf0 authored by POTTIER Francois's avatar POTTIER Francois

Update demos/calc-incremental-dune.

parent 0ee21ba9
.PHONY: all clean test
DUNE := jbuilder
DUNE := dune
EXECUTABLE := calc.exe
all:
......
This demo is identical to the "calc-incremental" demo,
but uses dune (a.k.a. jbuilder)
instead of ocamlbuild.
This demo is identical to the `calc-incremental` demo
but uses dune instead of ocamlbuild.
......@@ -14,7 +14,7 @@ module I =
let rec loop lexbuf (checkpoint : int I.checkpoint) =
match checkpoint with
| I.InputNeeded env ->
| I.InputNeeded _env ->
(* The parser needs a token. Request one from the lexer,
and offer it to the parser, which will produce a new
checkpoint. Then, repeat. *)
......@@ -27,7 +27,7 @@ let rec loop lexbuf (checkpoint : int I.checkpoint) =
| I.AboutToReduce _ ->
let checkpoint = I.resume checkpoint in
loop lexbuf checkpoint
| I.HandlingError env ->
| I.HandlingError _env ->
(* The parser has suspended itself because of a syntax error. Stop. *)
Printf.fprintf stderr
"At offset %d: syntax error.\n%!"
......@@ -40,6 +40,8 @@ let rec loop lexbuf (checkpoint : int I.checkpoint) =
we stop as soon as the parser reports [HandlingError]. *)
assert false
let _ = loop (* silence OCaml's unused-value warning about [loop] *)
(* -------------------------------------------------------------------------- *)
(* The above loop is shown for explanatory purposes, but can in fact be
......@@ -92,4 +94,3 @@ let rec repeat channel =
let () =
repeat (from_channel stdin)
(ocamllex
(modules lexer)
)
(menhir
(modules parser)
(flags ("--table"))
)
(executable
(name calc)
(libraries menhirLib)
)
(lang dune 1.4)
(using menhir 2.0)
(jbuild_version 1)
(ocamllex (lexer))
(menhir (
(modules (parser))
(flags ("--table"))
))
(executable (
(name calc)
(libraries (menhirLib))
))
......@@ -14,7 +14,7 @@ module I =
let rec loop lexbuf (checkpoint : int I.checkpoint) =
match checkpoint with
| I.InputNeeded env ->
| I.InputNeeded _env ->
(* The parser needs a token. Request one from the lexer,
and offer it to the parser, which will produce a new
checkpoint. Then, repeat. *)
......@@ -27,7 +27,7 @@ let rec loop lexbuf (checkpoint : int I.checkpoint) =
| I.AboutToReduce _ ->
let checkpoint = I.resume checkpoint in
loop lexbuf checkpoint
| I.HandlingError env ->
| I.HandlingError _env ->
(* The parser has suspended itself because of a syntax error. Stop. *)
Printf.fprintf stderr
"At offset %d: syntax error.\n%!"
......@@ -40,6 +40,8 @@ let rec loop lexbuf (checkpoint : int I.checkpoint) =
we stop as soon as the parser reports [HandlingError]. *)
assert false
let _ = loop (* silence OCaml's unused-value warning about [loop] *)
(* -------------------------------------------------------------------------- *)
(* The above loop is shown for explanatory purposes, but can in fact be
......@@ -92,4 +94,3 @@ let rec repeat channel =
let () =
repeat (from_channel stdin)
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