Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
menhir
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
11
Issues
11
List
Boards
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
POTTIER Francois
menhir
Commits
894ed838
Commit
894ed838
authored
Jan 18, 2015
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved the list and stream functions to a new module [MenhirLib.General].
parent
1fec3725
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
46 deletions
+8
-46
GNUmakefile
GNUmakefile
+1
-0
LICENSE
LICENSE
+1
-0
src/IncrementalEngine.ml
src/IncrementalEngine.ml
+2
-17
src/_tags
src/_tags
+1
-0
src/engine.ml
src/engine.ml
+2
-29
src/menhirLib.mlpack
src/menhirLib.mlpack
+1
-0
No files found.
GNUmakefile
View file @
894ed838
...
...
@@ -85,6 +85,7 @@ LIBFILES := \
src/IncrementalEngine.ml
\
src/engineTypes.ml
\
src/engine.
{
ml,mli
}
\
src/general.
{
ml,mli
}
\
src/inspectionTableFormat.ml
\
src/inspectionTableInterpreter.
{
ml,mli
}
\
src/tableFormat.ml
\
...
...
LICENSE
View file @
894ed838
...
...
@@ -13,6 +13,7 @@ In the following, "the Library" refers to the following files:
src/tableFormat.ml
src/tableInterpreter.{ml,mli}
src/convert.{ml,mli}
src/general.{ml,mli}
while "the Generator" refers to all other files in this archive.
...
...
src/IncrementalEngine.ml
View file @
894ed838
open
General
(* This signature describes the incremental LR engine. *)
(* In this mode, the user controls the lexer, and the parser suspends
...
...
@@ -69,23 +71,6 @@ module type INCREMENTAL_ENGINE = sig
type
'
a
lr1state
(* A stream is a list whose elements are produced on demand. *)
type
'
a
stream
=
'
a
head
Lazy
.
t
and
'
a
head
=
|
Nil
|
Cons
of
'
a
*
'
a
stream
(* The length of a stream. *)
val
length
:
'
a
stream
->
int
(* Folding over a stream. *)
val
foldr
:
(
'
a
->
'
b
->
'
b
)
->
'
a
stream
->
'
b
->
'
b
(* An element is a pair of a non-initial state [s] and a semantic value [v]
associated with the incoming symbol of this state. The idea is, the value
[v] was pushed onto the stack just before the state [s] was entered. Thus,
...
...
src/_tags
View file @
894ed838
...
...
@@ -31,3 +31,4 @@
<tableFormat.cmx>: for-pack(MenhirLib)
<tableInterpreter.cmx>: for-pack(MenhirLib)
<convert.cmx>: for-pack(MenhirLib)
<general.cmx>: for-pack(MenhirLib)
src/engine.ml
View file @
894ed838
...
...
@@ -503,35 +503,6 @@ module Make (T : TABLE) = struct
(* --------------------------------------------------------------------------- *)
(* Streams. *)
type
'
a
stream
=
'
a
head
Lazy
.
t
and
'
a
head
=
|
Nil
|
Cons
of
'
a
*
'
a
stream
(* The length of a stream. *)
let
rec
length
xs
=
match
Lazy
.
force
xs
with
|
Nil
->
0
|
Cons
(
_
,
xs
)
->
1
+
length
xs
(* Folding over a stream. *)
let
rec
foldr
f
xs
accu
=
match
Lazy
.
force
xs
with
|
Nil
->
accu
|
Cons
(
x
,
xs
)
->
f
x
(
foldr
f
xs
accu
)
(* --------------------------------------------------------------------------- *)
(* Stack inspection. *)
(* We offer a read-only view of the parser's state as a stream of elements.
...
...
@@ -542,6 +513,8 @@ module Make (T : TABLE) = struct
type
element
=
|
Element
:
'
a
lr1state
*
'
a
*
Lexing
.
position
*
Lexing
.
position
->
element
open
General
type
stack
=
element
stream
...
...
src/menhirLib.mlpack
View file @
894ed838
...
...
@@ -5,6 +5,7 @@ InfiniteArray
LinearizedArray
PackedIntArray
RowDisplacement
General
IncrementalEngine
EngineTypes
Engine
...
...
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