Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
menhir
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
12
Issues
12
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
POTTIER Francois
menhir
Commits
95108b25
Commit
95108b25
authored
Feb 04, 2015
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added experimental --lalr switch. Untested!
parent
0e2ddb29
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
2 deletions
+22
-2
src/invariant.ml
src/invariant.ml
+2
-1
src/lr1.ml
src/lr1.ml
+15
-1
src/settings.ml
src/settings.ml
+3
-0
src/settings.mli
src/settings.mli
+2
-0
No files found.
src/invariant.ml
View file @
95108b25
...
...
@@ -792,7 +792,8 @@ let (has_default_reduction : Lr1.node -> (Production.index * TerminalSet.t) opti
|
Settings
.
ModeCanonical
->
None
|
Settings
.
ModeInclusionOnly
|
Settings
.
ModePager
->
|
Settings
.
ModePager
|
Settings
.
ModeLALR
->
reduction
end
...
...
src/lr1.ml
View file @
95108b25
...
...
@@ -299,6 +299,8 @@ let materialize (source : node) (symbol : Symbol.t) (target : Lr0.lr1state) : un
(* 20120525: the manner in which this check is performed depends on
[Settings.construction_mode]. There are now three modes. *)
(* 20150204: there are now four modes. *)
begin
match
Settings
.
construction_mode
with
|
Settings
.
ModeCanonical
->
...
...
@@ -327,6 +329,9 @@ let materialize (source : node) (symbol : Symbol.t) (target : Lr0.lr1state) : un
raise
(
Subsumed
node
)
)
similar
|
Settings
.
ModeLALR
->
()
end
;
begin
match
Settings
.
construction_mode
with
...
...
@@ -352,6 +357,15 @@ let materialize (source : node) (symbol : Symbol.t) (target : Lr0.lr1state) : un
raise
(
Compatible
node
)
)
similar
|
Settings
.
ModeLALR
->
(* In LALR mode, as soon as there is one similar state -- i.e. one
state that shares the same LR(0) core -- we merge the new state
into the existing one. *)
List
.
iter
(
fun
node
->
raise
(
Compatible
node
)
)
similar
end
;
(* The above checks have failed. Create a new node. Two states that are in
...
...
@@ -376,7 +390,7 @@ let materialize (source : node) (symbol : Symbol.t) (target : Lr0.lr1state) : un
that all transition decisions made so far are explicit. *)
node
.
state
<-
Lr0
.
union
target
node
.
state
;
follow_state
"Joining and growing existing state
(Pager says, fine)
"
node
true
;
follow_state
"Joining and growing existing state"
node
true
;
source
.
transitions
<-
SymbolMap
.
add
symbol
node
source
.
transitions
;
grow_successors
node
...
...
src/settings.ml
View file @
95108b25
...
...
@@ -31,6 +31,8 @@ type construction_mode =
relationship, default reductions are used *)
|
ModePager
(* normal mode: states are merged as per Pager's criterion,
default reductions are used *)
|
ModeLALR
(* --lalr : states are merged as in an LALR generator,
i.e. as soon as they have the same LR(0) core *)
(* Note that --canonical overrides --no-pager. If both are specified, the result
is a canonical automaton. *)
...
...
@@ -176,6 +178,7 @@ let options = Arg.align [
"--inspection"
,
Arg
.
Set
inspection
,
" Generate the inspection API (requires --table)"
;
"--interpret"
,
Arg
.
Set
interpret
,
" Interpret the sentences provided on stdin"
;
"--interpret-show-cst"
,
Arg
.
Set
interpret_show_cst
,
" Show a concrete syntax tree upon acceptance"
;
"--lalr"
,
Arg
.
Unit
(
fun
()
->
construction_mode
:=
ModeLALR
)
,
" Construct an LALR(1) automaton"
;
"--log-automaton"
,
Arg
.
Set_int
logA
,
"<level> Log information about the automaton"
;
"--log-code"
,
Arg
.
Set_int
logC
,
"<level> Log information about the generated code"
;
"--log-grammar"
,
Arg
.
Set_int
logG
,
"<level> Log information about the grammar"
;
...
...
src/settings.mli
View file @
95108b25
...
...
@@ -21,6 +21,8 @@ type construction_mode =
relationship, default reductions are used *)
|
ModePager
(* normal mode: states are merged as per Pager's criterion,
default reductions are used *)
|
ModeLALR
(* --lalr : states are merged as in an LALR generator,
i.e. as soon as they have the same LR(0) core *)
val
construction_mode
:
construction_mode
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment