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
b5cb07e8
Commit
b5cb07e8
authored
Jan 18, 2015
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added comparison functions for productions and items.
parent
9a2f8a37
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
src/IncrementalEngine.ml
src/IncrementalEngine.ml
+9
-7
src/inspectionTableInterpreter.ml
src/inspectionTableInterpreter.ml
+9
-0
No files found.
src/IncrementalEngine.ml
View file @
b5cb07e8
...
...
@@ -134,13 +134,6 @@ module type INSPECTION = sig
include
SYMBOLS
(* Ordering functions. *)
val
compare_terminals
:
_
terminal
->
_
terminal
->
int
val
compare_nonterminals
:
_
nonterminal
->
_
nonterminal
->
int
val
compare_symbols
:
xsymbol
->
xsymbol
->
int
val
compare_words
:
xsymbol
list
->
xsymbol
list
->
int
(* The type ['a lr1state] is meant to be the same as in [INCREMENTAL_ENGINE]. *)
type
'
a
lr1state
...
...
@@ -158,6 +151,15 @@ module type INSPECTION = sig
type
item
=
production
*
int
(* Ordering functions. *)
val
compare_terminals
:
_
terminal
->
_
terminal
->
int
val
compare_nonterminals
:
_
nonterminal
->
_
nonterminal
->
int
val
compare_symbols
:
xsymbol
->
xsymbol
->
int
val
compare_words
:
xsymbol
list
->
xsymbol
list
->
int
val
compare_productions
:
production
->
production
->
int
val
compare_items
:
item
->
item
->
int
(* [incoming_symbol s] is the incoming symbol of the state [s], that is,
the symbol that the parser must recognize before (has recognized when)
it enters the state [s]. This function gives access to the semantic
...
...
src/inspectionTableInterpreter.ml
View file @
b5cb07e8
...
...
@@ -104,6 +104,15 @@ module Make
let
compare_words
w1
w2
=
General
.
compare
compare_symbols
w1
w2
let
compare_productions
prod1
prod2
=
(* Subtraction is safe because overflow is impossible. *)
prod1
-
prod2
let
compare_items
(
prod1
,
index1
)
(
prod2
,
index2
)
=
let
c
=
compare_productions
prod1
prod2
in
(* Subtraction is safe because overflow is impossible. *)
if
c
<>
0
then
c
else
index1
-
index2
(* The function [incoming_symbol] goes through the tables [T.lr0_core] and
[T.lr0_incoming]. This yields a representation of type [xsymbol], out of
which we strip the [X] quantifier, so as to get a naked symbol. This last
...
...
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