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
55b651b1
Commit
55b651b1
authored
Oct 06, 2015
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup. Replaced [shift_precedence] with [prec_annotation] everywhere.
parent
9edfa5e2
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
19 additions
and
19 deletions
+19
-19
src/fancy-parser.mly
src/fancy-parser.mly
+1
-1
src/grammar.ml
src/grammar.ml
+5
-8
src/parameterizedGrammar.ml
src/parameterizedGrammar.ml
+1
-1
src/partialGrammar.ml
src/partialGrammar.ml
+4
-4
src/syntax.mli
src/syntax.mli
+5
-2
src/unparameterizedPrinter.ml
src/unparameterizedPrinter.ml
+1
-1
src/unparameterizedSyntax.ml
src/unparameterizedSyntax.ml
+1
-1
src/yacc-parser.mly
src/yacc-parser.mly
+1
-1
No files found.
src/fancy-parser.mly
View file @
55b651b1
...
...
@@ -222,7 +222,7 @@ production_group:
{
pr_producers
;
pr_action
;
pr_branch_
shift_precedence
=
ParserAux
.
override
pos
oprec1
oprec2
;
pr_branch_
prec_annotation
=
ParserAux
.
override
pos
oprec1
oprec2
;
pr_branch_reduce_precedence
=
rprec
;
pr_branch_position
=
pos
})
...
...
src/grammar.ml
View file @
55b651b1
...
...
@@ -560,15 +560,12 @@ module Production = struct
let
(
_
:
int
)
=
StringMap
.
fold
(
fun
nonterminal
{
branches
=
branches
}
k
->
let
nt
=
Nonterminal
.
lookup
nonterminal
in
let
k'
=
List
.
fold_left
(
fun
k
branch
->
let
action
=
branch
.
action
and
sprec
=
branch
.
branch_shift_precedence
and
rprec
=
branch
.
branch_reduce_precedence
in
let
symbols
=
Array
.
of_list
branch
.
producers
in
table
.
(
k
)
<-
(
nt
,
Array
.
map
(
fun
(
v
,
_
)
->
Symbol
.
lookup
v
)
symbols
);
identifiers
.
(
k
)
<-
Array
.
map
snd
symbols
;
actions
.
(
k
)
<-
Some
action
;
reduce_precedence
.
(
k
)
<-
rprec
;
prec_decl
.
(
k
)
<-
sprec
;
actions
.
(
k
)
<-
Some
branch
.
action
;
reduce_precedence
.
(
k
)
<-
branch
.
branch_reduce_precedence
;
prec_decl
.
(
k
)
<-
branch
.
branch_prec_annotation
;
positions
.
(
k
)
<-
[
branch
.
branch_position
];
k
+
1
)
k
branches
in
...
...
@@ -740,7 +737,7 @@ module Production = struct
let
combine
e1
e2
=
lazy
(
Lazy
.
force
e1
;
Lazy
.
force
e2
)
let
shift_
precedence
prod
=
let
precedence
prod
=
let
fact1
,
prec_decl
=
consult_prec_decl
prod
in
let
oterminal
=
match
prec_decl
with
...
...
@@ -1461,7 +1458,7 @@ module Precedence = struct
let
shift_reduce
tok
prod
=
let
fact1
,
tokp
=
Terminal
.
precedence_level
tok
and
fact2
,
prodp
=
Production
.
shift_
precedence
prod
in
and
fact2
,
prodp
=
Production
.
precedence
prod
in
match
precedence_order
tokp
prodp
with
(* Our information is inconclusive. Drop [fact1] and [fact2],
...
...
src/parameterizedGrammar.ml
View file @
55b651b1
...
...
@@ -557,7 +557,7 @@ let expand p_grammar =
branch_position
=
pbranch
.
pr_branch_position
;
producers
=
new_producers
;
action
=
pbranch
.
pr_action
;
branch_
shift_precedence
=
pbranch
.
pr_branch_shift_precedence
;
branch_
prec_annotation
=
pbranch
.
pr_branch_prec_annotation
;
branch_reduce_precedence
=
pbranch
.
pr_branch_reduce_precedence
;
}
...
...
src/partialGrammar.ml
View file @
55b651b1
...
...
@@ -650,9 +650,9 @@ let check_parameterized_grammar_is_well_defined grammar =
(* Check each branch. *)
(
fun
{
pr_producers
=
producers
;
pr_branch_shift_precedence
=
sprec
;
pr_action
=
action
}
->
ignore
(
List
.
fold_left
pr_branch_prec_annotation
;
pr_action
=
action
}
->
ignore
(
List
.
fold_left
(* Check the producers. *)
(
fun
already_seen
(
id
,
p
)
->
...
...
@@ -686,7 +686,7 @@ let check_parameterized_grammar_is_well_defined grammar =
check_keywords
producers
action
;
match
sprec
with
match
pr_branch_prec_annotation
with
|
None
->
()
...
...
src/syntax.mli
View file @
55b651b1
...
...
@@ -85,7 +85,10 @@ type declaration =
|
DType
of
Stretch
.
ocamltype
*
parameter
type
branch_shift_precedence
=
(* A [%prec] annotation is optional. A production can carry at most one.
If there is one, it is a symbol name. *)
type
branch_prec_annotation
=
symbol
Positions
.
located
option
type
branch_reduce_precedence
=
...
...
@@ -99,7 +102,7 @@ type parameterized_branch =
pr_branch_position
:
Positions
.
t
;
pr_producers
:
producer
list
;
pr_action
:
action
;
pr_branch_
shift_precedence
:
branch_shift_precedence
;
pr_branch_
prec_annotation
:
branch_prec_annotation
;
pr_branch_reduce_precedence
:
branch_reduce_precedence
}
...
...
src/unparameterizedPrinter.ml
View file @
55b651b1
...
...
@@ -131,7 +131,7 @@ let string_of_producer mode (symbol, ido) =
let
print_branch
mode
f
branch
=
Printf
.
fprintf
f
"%s%s
\n
{"
(
String
.
concat
" "
(
List
.
map
(
string_of_producer
mode
)
branch
.
producers
))
(
Misc
.
o2s
branch
.
branch_
shift_precedence
(
fun
x
->
" %prec "
^
x
.
value
));
(
Misc
.
o2s
branch
.
branch_
prec_annotation
(
fun
x
->
" %prec "
^
x
.
value
));
begin
match
mode
with
|
PrintNormal
->
Action
.
print
f
branch
.
action
...
...
src/unparameterizedSyntax.ml
View file @
55b651b1
...
...
@@ -21,7 +21,7 @@ type branch =
producers
:
(
symbol
*
identifier
)
list
;
(* TEMPORARY convention renversée
par rapport à syntax.mli; faire un type record au lieu d'une paire? *)
action
:
action
;
branch_
shift_precedence
:
branch_shift_precedence
;
branch_
prec_annotation
:
branch_prec_annotation
;
branch_reduce_precedence
:
branch_reduce_precedence
}
...
...
src/yacc-parser.mly
View file @
55b651b1
...
...
@@ -276,7 +276,7 @@ production_group:
{
pr_producers
;
pr_action
;
pr_branch_
shift_precedence
=
ParserAux
.
override
pos
oprec1
oprec2
;
pr_branch_
prec_annotation
=
ParserAux
.
override
pos
oprec1
oprec2
;
pr_branch_reduce_precedence
=
rprec
;
pr_branch_position
=
pos
})
...
...
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