Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
b689503a
Commit
b689503a
authored
Jul 10, 2007
by
Pietro Abate
Browse files
[r2004-06-25 14:10:58 by afrisch] Fix for records
Original author: afrisch Date: 2004-06-25 14:10:58+00:00
parent
22da9816
Changes
2
Hide whitespace changes
Inline
Side-by-side
cdo2cmo/ml_generator.ml
View file @
b689503a
...
...
@@ -534,7 +534,7 @@ let cduce2ocaml_desc = cduce2ocaml_fun None
let
ocaml2cduce_record
(
name
,
desc
)
=
let
func
=
Code
.
Ml_ident
"mk_qname"
in
let
cod1
=
Code
.
Ml_abstraction
(
func
,
[
Code
.
Ml_
ident
name
]
)
in
let
cod1
=
Code
.
Ml_abstraction
(
func
,
[
Code
.
Ml_
string
name
]
)
in
let
cod2
=
Code
.
Ml_ident
(
"x."
^
name
)
in
let
cod2
=
Code
.
Ml_abstraction
(
ocaml2cduce_fun
desc
,
[
cod2
]
)
in
Code
.
Ml_tuple
[
cod1
;
cod2
]
...
...
@@ -600,6 +600,7 @@ let cduce2ocaml_record ( name, desc ) =
let
func
=
Code
.
Ml_ident
"record_field"
in
let
code
=
Code
.
Ml_ident
(
"
\"
"
^
name
^
"
\"
"
)
in
let
code
=
Code
.
Ml_abstraction
(
func
,
[
Code
.
Ml_ident
"map"
;
code
]
)
in
let
code
=
Code
.
Ml_abstraction
(
desc
,
[
code
]
)
in
name
,
code
let
cduce2ocaml_variant
(
name
,
list
)
=
match
list
with
...
...
@@ -701,7 +702,7 @@ end = struct
and
generate_main
cduce_cu
=
List
.
fold_left
(
generate_hnode
cduce_cu
)
[]
let
generate
fmt
modname
caml_cu
cduce_cu
=
Format
.
fprintf
fmt
"open Cdml@."
;
Format
.
fprintf
fmt
"open Cdml@.
open CDuce_all@.
"
;
Format
.
fprintf
fmt
"exception Error of string@."
;
Format
.
fprintf
fmt
"let comp_unit = Cdml.initialize
\"
%s
\"
@."
modname
;
let
code
=
generate_main
cduce_cu
(
CompUnit
.
hnodes
caml_cu
)
in
...
...
cdo2cmo/ml_ocaml.ml
View file @
b689503a
...
...
@@ -47,6 +47,7 @@ module Code = struct
|
Ml_fun
of
ml
*
ml
|
Ml_function
of
(
ml
*
ml
)
list
*
bool
|
Ml_ident
of
string
|
Ml_string
of
string
|
Ml_let_in
of
ml
*
ml
*
ml
|
Ml_list
of
ml
list
|
Ml_match
of
ml
*
(
ml
*
ml
)
list
*
bool
...
...
@@ -203,6 +204,9 @@ let rec print_ml fmt level = function
|
Code
.
Ml_ident
name
->
print_tabs
fmt
level
;
Format
.
fprintf
fmt
"%s"
name
|
Code
.
Ml_string
name
->
print_tabs
fmt
level
;
Format
.
fprintf
fmt
"
\"
%s
\"
"
name
|
Code
.
Ml_let_in
(
c1
,
c2
,
c3
)
->
print_tabs
fmt
level
;
Format
.
fprintf
fmt
"let "
;
...
...
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