Commit 71754e61 authored by POTTIER Francois's avatar POTTIER Francois

Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/menhir/menhir

Conflicts:
	TODO
parents c9e748ad 33b4eb78
2015/01/16:
Fixed a couple bugs in Makefile and src/Makefile which would cause
compilation and installation to fail with "TARGET=byte". (Reported
by Jérémie Courrèges-Anglas and Daniel Dickman.)
2015/01/01:
Incompatible change of the incremental API.
The entry point main_incremental is now named Incremental.main.
......
......@@ -122,7 +122,7 @@ package: clean
@ $(MAKE) -C src api
# Create the tarball.
@ echo "-> Tarball creation."
tar --exclude=.svn -cvz -f $(TARBALL) $(PACKAGE)
tar --exclude=.gitignore -cvz -f $(TARBALL) $(PACKAGE)
@ echo "-> Package $(PACKAGE).tar.gz is ready."
check:
......
......@@ -95,7 +95,7 @@ install:
mkdir -p $(libdir)
mkdir -p $(docdir)
mkdir -p $(mandir)
install $(BUILDDIR)/menhir.native $(bindir)/$(MENHIREXE)
install $(BUILDDIR)/menhir.$(TARGET) $(bindir)/$(MENHIREXE)
install -m 644 $(MLYLIB) $(libdir)
cp -r $(DOCS) $(docdir)
cp -r $(MANS) $(mandir)
......
* Add left-recursive lists to the standard library.
* Define [print_result].
Define a printer that shows the states in the stack.
Try computing a set of expected symbols in the current state.
* Generate default printers for terminal and nonterminal.
* IncrementalEngine: document [lr1state], [element], [view].
......
......@@ -8,7 +8,7 @@ all:
done
clean:
/bin/rm -f *~ .*~ *.omc
/bin/rm -f *~ .*~
@for i in $(DEMOS) ; do \
$(MAKE) -C $$i clean ; \
done
......@@ -20,7 +20,7 @@ all:
$(OCAMLBUILD) $(MAIN).native
clean:
rm -f *~
rm -f *~ .*~
$(OCAMLBUILD) -clean
test: all
......
......@@ -20,7 +20,7 @@ all:
$(OCAMLBUILD) $(MAIN).native
clean:
rm -f *~
rm -f *~ .*~
$(OCAMLBUILD) -clean
test: all
......
......@@ -15,7 +15,7 @@ all:
$(OCAMLBUILD) $(MAIN).native
clean:
rm -f *~
rm -f *~ .*~
$(OCAMLBUILD) -clean
test: all
......
......@@ -183,7 +183,8 @@ module type INSPECTION = sig
val rhs: production -> xsymbol list
(* [items s] is the set of the LR(0) items in the LR(0) core of the LR(1)
state [s]. This set is presented as a list, in an arbitrary order. *)
state [s]. This set is not epsilon-closed. This set is presented as a
list, in an arbitrary order. *)
val items: 'a lr1state -> item list
......
......@@ -60,11 +60,15 @@ stage1:
# Stage 2.
# Build Menhir using Menhir (from stage 1).
FLAGS := -v -lg 1 -la 1 -lc 1 --comment --infer --stdlib . --strict --fixed-exception
# Do not use . to refer to the current directory, because ocamlbuild
# descends into another directory when executing commands.
SRC := $(shell pwd)
FLAGS := -v -lg 1 -la 1 -lc 1 --comment --infer --stdlib $(SRC) --strict --fixed-exception
stage2:
@$(OCAMLBUILD) -build-dir _stage2 -tag fancy_parser \
-use-menhir -menhir "$(shell pwd)/_stage1/menhir.$(TARGET) $(FLAGS)" \
-use-menhir -menhir "$(SRC)/_stage1/menhir.$(TARGET) $(FLAGS)" \
menhir.$(TARGET)
# ----------------------------------------------------------------------------
......@@ -73,7 +77,7 @@ stage2:
# is identical to the stage 2 parser.
stage3:
@$(OCAMLBUILD) -build-dir _stage3 -tag fancy_parser \
-use-menhir -menhir "$(shell pwd)/_stage2/menhir.$(TARGET) $(FLAGS)" \
-use-menhir -menhir "$(SRC)/_stage2/menhir.$(TARGET) $(FLAGS)" \
parser.ml parser.mli
@for i in parser.ml parser.mli ; do \
if ! diff _stage2/$$i _stage3/$$i 2>&1 >/dev/null ; then \
......
......@@ -1092,6 +1092,8 @@ let rec convert = function
module Analysis = struct
let nullable = Array.get nullable
let nullable_first_rhs = nullable_first_rhs
let explain_first_rhs (tok : Terminal.t) (rhs : Symbol.t array) (i : int) =
......
......@@ -363,6 +363,12 @@ end
module Analysis : sig
(* [nullable nt] is the NULLABLE flag of the non-terminal symbol [nt].
That is, it is true if and only if this symbol produces the empty
word [epsilon]. *)
val nullable: Nonterminal.t -> bool
(* [nullable_first_rhs rhs i] considers the string of symbols found at
offset [i] in the array [rhs]. It returns its NULLABLE flag as well
as its FIRST set. The offset [i] must be contained between [0] and
......
......@@ -47,5 +47,11 @@ module type TABLES = sig
val lr0_incoming: PackedIntArray.t
(* A table that tells which non-terminal symbols are nullable. *)
val nullable: string
(* Like the [error] bitmap, this is the second component
of a packed int array of bit width 1. *)
end
......@@ -902,6 +902,23 @@ let lr0_items () =
(* ------------------------------------------------------------------------ *)
(* A table that tells which nonterminal symbols are nullable.
(For simplicity, this table includes the start symbols.) *)
let nullable () =
assert Settings.inspection;
let nullable : int list =
Nonterminal.map (fun nt ->
if Analysis.nullable nt then 1 else 0
)
in
define_and_measure (
"nullable",
marshal11_list nullable
)
(* ------------------------------------------------------------------------ *)
(* Let's put everything together. *)
open UnparameterizedSyntax
......@@ -1015,6 +1032,7 @@ let program =
rhs() ::
lr0_core() ::
lr0_items() ::
nullable() ::
[]
) ::
[]
......
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