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
58b311ad
Commit
58b311ad
authored
Jul 10, 2007
by
Pietro Abate
Browse files
[r2003-05-25 17:26:23 by cvscast] Doc
Original author: cvscast Date: 2003-05-25 17:26:23+00:00
parent
b9c7e1ea
Changes
4
Show whitespace changes
Inline
Side-by-side
README
View file @
58b311ad
...
...
@@ -28,24 +28,24 @@ Overview of the distribution
See the INSTALL file for Installation instructions.
1. CDuce command-line interpreter
1. CDuce command-line interpreter
/ toplevel
For performance reasons, it is advised to build it using OCaml native code
compiler (by default in the Makefile).
Usage:
cduce [options] [CDuce files] -- [arguments for the CDuce program]
cduce [options] [CDuce files] --
arg
[arguments for the CDuce program]
The arguments following the -- are passed to the CDuce program
The arguments following the --
arg
are passed to the CDuce program
in the argv variable (having type [ String* ], which means: sequence
of character strings).
The option -quiet suppresses normal output (typing, results). It is
The option
-
-quiet suppresses normal output (typing, results). It is
normally used when the CDuce interpreter is used in the context
of batch processing.
The option -dump followed by a filename allows persistence between
The option
-
-dump followed by a filename allows persistence between
several invocations of the interpreter: the current environment
(defined types and values) is saved to the file when the interpreter
terminates and it is restored if the interpreter is started again with
...
...
@@ -53,7 +53,10 @@ the same option. Note that only the arguments after -- on the first
invocation in a session are passed to the CDuce program.
When no CDuce file is given on the command line, the interpreter
uses the standard input.
behaves as a toplevel. Phrases are interpreted when the user type
";;". Of course, mutually recursive definition (types or functions)
must be entirely contained in an adjacent sequence of phrases
(without ";;" inbetween).
2. CDuce CGI interface
...
...
driver/run.ml
View file @
58b311ad
...
...
@@ -55,7 +55,6 @@ let read i =
flush
stdout
;
first_line
:=
false
;
let
c
=
input_char
stdin
in
flush
stderr
;
bol
:=
(
not
first
)
&&
c
=
'\n'
;
Some
c
...
...
@@ -68,7 +67,7 @@ let toploop () =
ignore
(
Cduce
.
toplevel
ppf
ppf_err
input
);
loop
()
in
try
loop
()
with
End_of_file
->
exit
0
with
End_of_file
->
()
let
do_file
s
=
let
chan
=
open_in
s
in
...
...
web/examples/mutrec.cd
View file @
58b311ad
(* A
ll the types submitted
at
on
ce
are mutually recursive *)
(* A
djacent type declar
at
i
on
s
are mutually recursive *)
type T = <t>S;;
type S = [ (Char | T)* ];;
let x : S = [ 'abc' <t>['def'] 'ghi' ];;
(* Consecutive function definitions (without any other toplevel phrase
in the middle) are grouped together *)
(* Similarly for toplevel function definitions *)
let fun f (x : Int) : Int = g x;;
let fun g (x : Int) : Int = 3;;
...
...
web/manual/interpreter.xml
View file @
58b311ad
...
...
@@ -40,11 +40,32 @@ CDuce program(s). </li>
version number and exit immediately.
</li>
<li>
All the other arguments on the command line are considered CDuce
scripts, which are executed successively. If no CDuce file is given on
the command line, the interpreter uses the standard input.
</li>
scripts, which are executed successively.
</li>
</ul>
</box>
<box
title=
"Toplevel"
link=
"toplevel"
>
<p>
If no CDuce file is given on the command line, the interpreter
behaves as an interactive toplevel.
</p>
<p>
Toplevel phrases are processed after each
<code>
;;
</code>
.
Mutually recursive declaration of types or functions
must be contained in a single adjacent sequence of phrases
(without
<code>
;;
</code>
inbetween).
</p>
<p>
The toplevel has no line editing facilities.
You can use an external wrapper such as
<a
href=
"http://pauillac.inria.fr/~ddr/"
>
ledit
</a>
.
</p>
</box>
</page>
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