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
F
fix
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
POTTIER Francois
fix
Commits
96b7dc56
Commit
96b7dc56
authored
Nov 29, 2018
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Movement.
parent
8fad94a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
demos/brz/Brzozowski.ml
demos/brz/Brzozowski.ml
+20
-20
No files found.
demos/brz/Brzozowski.ml
View file @
96b7dc56
...
...
@@ -140,11 +140,6 @@ end
include
R
(* This makes it easy to define memoizing functions of type [regexp -> _]. *)
module
M
=
Memoize
.
ForHashedType
(
R
)
(* -------------------------------------------------------------------------- *)
(* The empty expression [0] is encoded as 0-ary disjunction. *)
...
...
@@ -187,6 +182,23 @@ let rec (@@) (e1 : regexp) (e2 : regexp) : regexp =
(* -------------------------------------------------------------------------- *)
(* Iteration. *)
let
star
(
e
:
regexp
)
:
regexp
=
match
skeleton
e
with
|
EEpsilon
|
EStar
_
->
(* [epsilon*] is [epsilon]. *)
(* [e**] is [e*]. *)
e
|
EDisj
[]
->
(* [0*] is [epsilon]. *)
epsilon
|
_
->
make
(
EStar
e
)
(* -------------------------------------------------------------------------- *)
(* Disjunction. *)
let
universal
e
=
...
...
@@ -235,21 +247,6 @@ let (&&&) e1 e2 =
(* -------------------------------------------------------------------------- *)
(* Iteration. *)
let
star
(
e
:
regexp
)
:
regexp
=
match
skeleton
e
with
|
EEpsilon
|
EStar
_
->
(* [epsilon*] is [epsilon]. *)
(* [e**] is [e*]. *)
e
|
EDisj
[]
->
(* [0*] is [epsilon]. *)
epsilon
|
_
->
make
(
EStar
e
)
(* Negation. *)
let
neg
(
e
:
regexp
)
:
regexp
=
...
...
@@ -273,6 +270,9 @@ let neg (e : regexp) : regexp =
(* We memoize this function. (This is optional.) *)
module
M
=
Memoize
.
ForHashedType
(
R
)
let
nullable
:
regexp
->
bool
=
M
.
fix
(
fun
nullable
e
->
match
skeleton
e
with
...
...
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