Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
POTTIER Francois
menhir
Commits
58f83dea
Commit
58f83dea
authored
Jun 12, 2020
by
POTTIER Francois
Browse files
Update BasicSyntax to keep the location of every producer identifier.
parent
39d2e899
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Drop.ml
View file @
58f83dea
...
...
@@ -33,7 +33,7 @@ let drop_parameter (param : S.parameter) : S.symbol =
let
drop_producer
((
id
,
param
,
attrs
)
:
S
.
producer
)
:
T
.
producer
=
{
T
.
producer_identifier
=
value
id
;
T
.
producer_identifier
=
id
;
T
.
producer_symbol
=
drop_parameter
param
;
T
.
producer_attributes
=
attrs
}
...
...
src/basicSyntax.ml
View file @
58f83dea
...
...
@@ -31,11 +31,12 @@ open Syntax
(* ------------------------------------------------------------------------ *)
(* A producer is a pair of identifier and a symbol. In concrete syntax, it
could be [e = expr], for instance. It carries a number of attributes. *)
(* A producer is a pair of a (located) identifier and a symbol. In concrete
syntax, it could be [e = expr], for instance. It carries a number of
attributes. *)
type
producer
=
{
producer_identifier
:
identifier
;
producer_identifier
:
identifier
located
;
producer_symbol
:
symbol
;
producer_attributes
:
attributes
;
}
...
...
@@ -95,9 +96,17 @@ type grammar = {
(* Accessors for the type [producer]. *)
let
producer_identifier
{
producer_identifier
}
=
producer_identifier
let
producer_symbol
{
producer_symbol
}
=
producer_symbol
let
producer_attributes
{
producer_attributes
}
=
producer_attributes
let
producer_identifier
{
producer_identifier
}
:
identifier
=
Positions
.
value
producer_identifier
let
producer_identifier_located
{
producer_identifier
}
:
identifier
located
=
producer_identifier
let
producer_symbol
{
producer_symbol
}
=
producer_symbol
let
producer_attributes
{
producer_attributes
}
=
producer_attributes
(* -------------------------------------------------------------------------- *)
...
...
src/inlining.ml
View file @
58f83dea
...
...
@@ -161,12 +161,14 @@ let rec fresh names x =
let
rename
(
used
:
StringSet
.
t
)
producers
:
Action
.
subst
*
producers
=
let
phi
,
_used
,
producers
=
List
.
fold_left
(
fun
(
phi
,
used
,
producers
)
producer
->
let
x
=
producer_identifier
producer
in
let
id
=
producer_identifier_located
producer
in
let
x
=
Positions
.
value
id
in
if
StringSet
.
mem
x
used
then
let
x'
=
fresh
used
x
in
let
id'
=
Positions
.
map
(
fun
_x
->
x'
)
id
in
(
x
,
x'
)
::
phi
,
StringSet
.
add
x'
used
,
{
producer
with
producer_identifier
=
x
'
}
::
producers
{
producer
with
producer_identifier
=
id
'
}
::
producers
else
(
phi
,
StringSet
.
add
x
used
,
producer
::
producers
)
)
([]
,
used
,
[]
)
producers
...
...
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