Skip to content
GitLab
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
7eb1a95d
Commit
7eb1a95d
authored
Jul 10, 2007
by
Pietro Abate
Browse files
[r2003-12-12 23:18:23 by afrisch] Cleaning
Original author: afrisch Date: 2003-12-12 23:18:23+00:00
parent
3910149c
Changes
4
Hide whitespace changes
Inline
Side-by-side
driver/cduce.ml
View file @
7eb1a95d
...
...
@@ -16,7 +16,6 @@ let prefix filename suff =
with
Invalid_argument
filename
->
failwith
"Not a point in the suffix?"
else
filename
let
quiet
=
ref
false
let
toplevel
=
ref
false
...
...
@@ -159,28 +158,25 @@ let rec print_exn ppf = function
let
display
ppf
l
=
if
not
!
quiet
then
List
.
iter
(
fun
(
x
,
t
)
->
dump_value
ppf
x
t
(
get_global_value
x
))
l
List
.
iter
(
fun
(
x
,
t
)
->
dump_value
ppf
x
t
(
get_global_value
x
))
l
let
eval_quiet
e
=
let
(
e
,
t
)
=
Typer
.
type_expr
!
typing_env
e
in
let
(
e
,
_
)
=
Typer
.
type_expr
!
typing_env
e
in
let
e
=
Compile
.
compile_eval
!
compile_env
e
in
Eval
.
expr
e
let
eval
ppf
e
=
let
(
e
,
t
)
=
Typer
.
type_expr
!
typing_env
e
in
if
not
!
quiet
then
Location
.
dump_loc
ppf
(
e
.
Typed
.
exp_loc
,
`Full
);
Location
.
dump_loc
ppf
(
e
.
Typed
.
exp_loc
,
`Full
);
let
e
=
Compile
.
compile_eval
!
compile_env
e
in
let
v
=
Eval
.
expr
e
in
if
not
!
quiet
then
Format
.
fprintf
ppf
"- : @[@[%a@] =@ @[%a@]@]@."
print_norm
t
print_value
v
;
Format
.
fprintf
ppf
"- : @[@[%a@] =@ @[%a@]@]@."
print_norm
t
print_value
v
;
v
let
let_decl
ppf
p
e
=
...
...
driver/cduce.mli
View file @
7eb1a95d
val
quiet
:
bool
ref
val
toplevel
:
bool
ref
val
enter_global_value
:
Ident
.
id
->
Value
.
t
->
Types
.
descr
->
unit
...
...
driver/run.ml
View file @
7eb1a95d
...
...
@@ -35,8 +35,8 @@ let specs = ref
" save persistency file after running CDuce program"
;
"--dump"
,
Arg
.
String
(
fun
s
->
save_dump
:=
Some
s
;
load_dump
:=
Some
s
)
,
" specify persistency file for loading and saving"
;
"--
quiet"
,
Arg
.
Set
Cduce
.
quiet
,
"
suppress normal
output (typing, results)"
;
"--
verbose"
,
Arg
.
Unit
(
fun
()
->
failwith
"--verbose: not yet implemented"
)
,
"verbose
output (typing, results)"
;
"--compile"
,
Arg
.
Set
compile
,
"compile the given CDuce file"
;
"--obj-dir"
,
Arg
.
String
(
fun
s
->
out_dir
:=
s
::
!
out_dir
)
,
...
...
@@ -47,8 +47,8 @@ let specs = ref
" execute the given .cdo file"
;
"--stdin"
,
Arg
.
Unit
(
fun
()
->
src
:=
""
::
!
src
)
,
" read CDuce script on standard input"
;
"--
verbose
"
,
Arg
.
Unit
(
fun
()
->
Stats
.
set_verbosity
Stats
.
Summary
)
,
"
print profiling/debugging information"
;
"--
debug
"
,
Arg
.
Unit
(
fun
()
->
Stats
.
set_verbosity
Stats
.
Summary
)
,
"
print profiling/debugging information"
;
"-v"
,
Arg
.
Unit
version
,
" print CDuce version"
;
"--version"
,
Arg
.
Unit
version
,
...
...
@@ -60,9 +60,7 @@ let specs = ref
]
let
ppf
=
if
!
Cduce
.
quiet
then
Format
.
formatter_of_buffer
(
Buffer
.
create
1023
)
else
Format
.
std_formatter
let
ppf
=
Format
.
std_formatter
let
ppf_err
=
Format
.
err_formatter
let
()
=
...
...
@@ -123,7 +121,6 @@ let outflush s =
flush
stdout
let
toploop
()
=
Cduce
.
toplevel
:=
true
;
let
restore
=
try
let
tcio
=
Unix
.
tcgetattr
Unix
.
stdin
in
...
...
@@ -190,7 +187,6 @@ let restore argv =
let
chan
=
open_in_bin
f
in
let
s
=
Marshal
.
from_channel
chan
in
close_in
chan
;
(* Serialize.Get.run Cduce.deserialize_typing_env s; *)
State
.
set
s
;
Format
.
fprintf
ppf
"done ...@."
with
Sys_error
_
->
...
...
@@ -203,7 +199,6 @@ let save () =
match
!
save_dump
with
|
Some
f
->
Format
.
fprintf
ppf
"Saving state ...@
\n
"
;
(* let s = Serialize.Put.run Cduce.serialize_typing_env () in *)
let
s
=
State
.
get
()
in
let
chan
=
open_out_bin
f
in
Marshal
.
to_channel
chan
s
[
Marshal
.
Closures
];
...
...
runtime/eval.mli
View file @
7eb1a95d
open
Value
open
Ident
open
Lambda
val
eval_unary_op
:
(
int
->
(
t
->
t
))
ref
val
eval_binary_op
:
(
int
->
(
t
->
t
->
t
))
ref
open
Lambda
val
from_comp_unit
:
(
Types
.
CompUnit
.
t
->
int
->
t
)
ref
val
dump
:
Format
.
formatter
->
unit
val
push
:
Value
.
t
->
unit
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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