SCP 4 you Quick Help
For a description on how use the SCP4, please see a SCP4 User's Guide (in Russian).
Bottom |
Bottom |
There are two versions of SCP4-script files. The versions correspond different operating systems: under Windows 95/98/NT and MS-DOS the script files have bat-extensions while under UNIX there is no extension.
At present a whole session of supercompilation consists from a number of stages:
- Translation of a Refal-5 program (to be transformed) to a Refal-graph. (inref4p.bat or inref4.bat)
- Translation of a MST-scheme in an inner representation of the configuration. (mst4p.bat or mst4.bat)
- Supercompilation itself: the main stage. (scp4.bat)
- Clearance of the input/output formats of functions from a residual program as well as redundant function calls. (redund.bat)
- Translation of a residual program to Refal-5. (cgr54.bat)
The first and second stages commute. The fourth stage is optional. The fourth and fifth stages transform a last result of the the third stage. A whole session can be run by a single script file (scpwholp.bat or scpwhole.bat).
Please, pay your attention that the supercompiler can looping forever
(by definition) under a combination of keys to run. Default keys are such combination.
There are a number of reasons for that. In the archive (to be
downloaded) version of the documentation we give a number of such examples.
inref4p filename.ref [/l] [/w] [/t]:
where filename.ref
is a file with a Refal-5
program , keys /key mean
l
-- put a message's listing to a file filename.lis
;w
-- inform of syntax warnings;t
-- treat of t-variables as t.X is equal to (e.X);inref4 filename.ref [/l] [/w] [/t]:
just a version of inref4p
, but filename.ref
is taken from INR-subdirectory which has to exist inside your current directory.
mst4p filename.mst [/l] [/w] [/t]:
where filename.mst
is a file with a MST
program , keys /key mean
l
-- put a message's listing to a file filename.mls
;w
-- inform of syntax warnings;t
-- treat of t-parametrs as t.X is equal to (e.X);The MST program is a program in the MST-schemes language to describe a start configuration (a parametrized set of inputs of a Refal-5 program to be transformed). In fact, the MST-scheme describes a context of using of the Refal-5 program and formulates a task for the supercompiler.
mst4 filename.mst [/l] [/w] [/t]:
just a version of mst4p
, but filename.mst
is taken from INR-subdirectory which has to exist inside
your current directory.scp4 filename.mst [+extern_rsl_file1+extern_rsl_file2...]
[debug_level]
filename.mst
is a file with an inner representation of a MST program. The file is
prepared with mst4p;
extern_rsl_fileN
is a rsl-module. The rsl-module is linked to SCP4. debug_level ::= usertrNUMBER | traceNUMBER | debugNUMBER
usertrNUMBER
=few messages ... debugNUMBER
=many verbose messages). Note debugging
messages are output inside the trace
-file as well as
on the screen.NUMBER
is a number of the Refal-machine
when the debugging messages are started. redund :
No arguments. The script transforms a residual
program which is a result of a last running of scp4
script-module. The residual program is taken from a directory which is found with TMPSCP environment variable.cgr54 filename.ref [/pretty_print] [/args]:
This script transforms a residual program which is a result of a last running
of scp4
script-module. The residual program is taken from a
directory which is found with TMPSCP environment variable.
filename.ref .
pretty_print ::= AK_format | AN_format
--
Pretty print formats. The last is by default. args
-- To have a call for a main function in a format to get parametrs from command's string of your
operating system.scpwholp filename.ref mst_filename [+extern_rsl_file1+extern_rsl_file2...]:
This script file presents whole session of supercompilation.
filename.ref
is a file with a Refal-5
program;mst_filename
is a file with a MST program (the mst-extension
has to be omitted);extern_rsl_fileN
is a rsl-module. The rsl-module is linked to SCP4.sscpwhole filename.ref mst_filename [+extern_rsl_file1+extern_rsl_file2...]:
just a version of scpwholp
,
but filename.ref
and mst_filename
are taken from INR-subdirectory
which has to exist inside a directory defined
with TMPSCP environment variable.Top | Bottom |
- The first one is a program in Refal-5 language which contains a number of definition-subroutines. Usually the subroutines are named (by programmers) as "functions". But ,in fact , the set of subroutines is not defined any function.
- One has to describe the function itself: a start configuration of a function composition (a state of stack) as well as domains of the functions from the composition. This second part of the task is described in the MST-schemes language. Your program in the language has to be put inside a file. A name of the file must be ended with the mst-extension.
REcursive Functions Algorithmic Language by Prof. Valentin F. Turchin (The City College of New York) .
- Please, see an online version of Refal-5: programming guide and reference manual.
- Scp4 (its inref4-stage) understands a number of pseudo-comments in spite of they are ignored by the Refal-5 compiler.
MetaSystem Transition schemes Language by Prof. Valentin F. Turchin (The City College of New York) .
- Please, see an online documentation on the language for details. Here we just give an informal introduction to the language.
- Here you can find a lot of programs in the language and brief comments to the programs.
The MST-schemes language is a two dimensional programming language.
- Every program in the language is a sequence of MST-schemes and declarations.
- All blanks in a MST-scheme are meaningful and semantics of every line from the MST-scheme depends on previous and next lines in the given MST-scheme.
- Syntax of a single line is a lot like the syntax of right parts of Refal's sentences while semantics is different.
- Semantics of a given line from a MST-scheme:
- the line is an object to be transformed by function calls from the previous line (whenever it exist);
- on the other hand, function calls from the line are subjects to transform the next line (whenever it exist);
If there exist a call to a supercompiler on a given line inside a MST-scheme, then the supercompiler treats a part from the next line ( those part which exactly under its arguments) as a parametrized set of inputs to a given program.
There are three types of parametrs -- e-parametrs , t-parametrs and s-parametrs.
- Domain of an e-parametr is the n-th image of a fixed function ( meta-coding). The meta-coding function is defined on whole set of the Refal object expressions. Under the n-th image we mean n-th power of the composition of the function with itself. For example, the second image is
<Meta-coding <Meta-coding e.object-expressions>>
- Domain of a t-parametr is the n-th image of a restriction of the meta-coding function to the set of the Refal terms.
- Domain of a s-parametr is the n-th image of a restriction of the meta-coding function to the set of the Refal symbols.
The power of the image depends on syntax the MST-scheme so , in the fact, every type has the countable set of subtypes. If there are two parametrs with the same types and names, then these parametrs can take just equal values.
A simple example of a MST-scheme is present on the next two lines:
<Scp4 ............................. > |
<Fcd <Fbc <Fab 'aebfc' e.1>>> ; |
The MST-scheme describes a classical task: to supercompile a
composition of three functions when the argument of the inner Fab-function
starts with string 'aebfc'
while the rest of the argument
is unknown and can be any object expression.
Top | Bottom |
A pseudo-comment is a line (in a Refal-5 program) which starts with *$DECLARATION
, where DECLARATION
is one of declaration
types. The pseudo-comments are understood by the Scp4 (inref4-stage)
while they are ignored by the Refal-5 compiler .
The available version of the Scp4 supports just one pseudo-comment:
*$EXECUTABLE function_name1, function_name2 ...;
If your Refal-5 program contains the pseudo-comment then calls to functions from the list will be executed by the Refal-5 interpreter in super-compile time if arguments of the calls turn out to be object expressions in a moment when the supercompiler will specialize these calls .
The next built-in functions Type Numb Symb Implode Add Sub Mul Div Mod Divmod
(see
Refal-5 documentation
for definitions) are executable by default.
You are responsible to link to the supercompiler definitions of functions which you declare as executable (see Session Of Supercompilation) .
Top | Bottom |
Top |
The online demonstration presents demo-examples from the Scp4 distribution. Here you can find a brief description of the examples.
You are welcome:
- To see any demo-example. All its modules are available. (see Session Of Supercompilation )
- To launch any demo-example. A trace of the Scp4 appears on the screen. To see a result , please, go to the end of the trace and click on a VIEW-button which offers a residual program in Refal-5. To see contents of the trace , please, take attention to an online documentation on the tracing .
- To modify any demo-example. All its modules are available to modify.
- To upload any module from your computer.
- To launch your example. You cannot use executable functions that are suspect from the security point of view.
Please, take attention:
- Your file will live for 20 minutes after an active act in the file.
- The server, where the online demonstration is installed , can be unreachable sometimes (very seldom, from 10:00 a.m. to 5:00 p.m. Moscow time).
- The Web lines can be overloaded. We recommend from 01:00 a.m. to 10:00 a.m. Moscow time for your experiments.
Top |