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
35e59e49
Commit
35e59e49
authored
Dec 06, 2017
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Front: implement selective expansion + safety test + full expansion.
parent
82b7a883
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
src/front.ml
src/front.ml
+15
-3
No files found.
src/front.ml
View file @
35e59e49
...
@@ -76,9 +76,21 @@ let sorts =
...
@@ -76,9 +76,21 @@ let sorts =
to obtain a grammar without parameterized nonterminal symbols. *)
to obtain a grammar without parameterized nonterminal symbols. *)
let
grammar
:
UnparameterizedSyntax
.
grammar
=
let
grammar
:
UnparameterizedSyntax
.
grammar
=
(* TEMPORARY do selective expansion first *)
let
module
S
=
SelectiveExpansion
in
CheckSafeParameterizedGrammar
.
check
grammar
;
(* First, perform a selective expansion: expand away all parameters of
Drop
.
drop
(
SelectiveExpansion
.
expand
SelectiveExpansion
.
ExpandAll
sorts
grammar
)
higher sort, keeping the parameters of sort [*]. This process always
terminates. *)
let
grammar1
=
S
.
expand
S
.
ExpandHigherSort
sorts
grammar
in
(* This "first-order parameterized grammar" can then be submitted to
the termination check. *)
CheckSafeParameterizedGrammar
.
check
grammar1
;
(* If it passes the check, then full expansion is safe. We drop [grammar1]
and start over from [grammar]. This is required in order to get correct
names. (Expanding [grammar1] would yield an equivalent grammar, with
more complicated names, reflecting the two steps of expansion.) *)
let
grammar
=
S
.
expand
S
.
ExpandAll
sorts
grammar
in
(* This yields an unparameterized grammar. *)
Drop
.
drop
grammar
let
()
=
let
()
=
Time
.
tick
"Joining and expanding"
Time
.
tick
"Joining and expanding"
...
...
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