Rutgers ALGOL 68: Difference between revisions

lang -> syntaxhighlight
(lang -> syntaxhighlight)
 
Line 19:
=== Lexical style ===
Rutgers ALGOL 68 is case-sensitive and uses quote-stropping. The standard bold-words are in lower case, e.g.:
<langsyntaxhighlight lang=algol68>'begin'
print( ( "Hello, World!", newline ) )
'end'</langsyntaxhighlight>
 
=== Transput ===
Line 41:
Place the following batch file into the the folder and execute it. The batch file asumes TCC is being used as the C compiler, change as appropriate. The DEFINES and ALINC variables may also need to be changed.
 
<langsyntaxhighlight lang=dos>rem build.bat: build the Linux version of RutgersAlgol68 under Windows
 
rem set CC and DEFINES as appropriate for your C compiler
Line 72:
cd ..
 
cd ..</langsyntaxhighlight>
 
Note that the interpreter requires &lt;sys/times.h&gt;, the TCC compiler used in the batch file above did not have one, the following dummy times.h can be used. If needed it should be placed in a sub-folder of the installation folder, called '''sys'''.
 
<langsyntaxhighlight lang=C>// times.h for RutgersAlgol68 - not a real timss.h
#include <time.h>
#define times(x) (unsigned) time(x)
// end RutgersAlgol68 times.h</langsyntaxhighlight>
 
The following batch file can be used to execute the interpreter with an upper-stropping source (as used by most of the samples on RC):
 
<langsyntaxhighlight lang=dos>@rem u68.bat: execute an upper-stropping Algol 68 source using Rutgers Algol 68
@
@set p=%1
Line 132:
@ %rBin%\dump.exe _.d68
@ exit /b 7
@:endR68</langsyntaxhighlight>
 
The '''prelude.r68''', '''postlude.r68''' and '''upperToQuote.r68''' soureces used by the above batch-file should be placed in the installation folder (\algolRutgersAlgol8 is assumed here). They are in the following sections on Using upper-stropping and Additional prelude items.
Line 142:
This should be placed in the installation folder (\algol\RutgersAlgol68 is assumed here) and called '''upperToQuote.r68'''.
 
<langsyntaxhighlight lang=algol68>'begin' # convert an upper-stropped source to Rutgers quote stropping #
'proc' control = ( 'char' letter )'char': 'repr' ( 1 + ( 'abs' letter - 'abs' "A" ) );
'char' ctrlE = control( "E" );
Line 338:
'fi'
'od'
'end'</langsyntaxhighlight>
 
Note that Rutgers Algol 68 does not implement transput event routines, so cannot detect EOF. The above program assumes EOF will be indicated by control-E followed by control-O followed by control-F.
Line 348:
The following source should be placed in the instalation folder (\algol\RutgersAlgol68 is assumed here) and named '''prelude.r68''':
 
<langsyntaxhighlight lang=algol68>'begin' # additional prelude declarations for Rutgers Algol 68 #
'int' max abs char = 255;
'mode' 'complex' = 'compl';
Line 391:
found
'end'; # char in string #
'begin'</langsyntaxhighlight>
 
The following source should be placed in the installaton folder (\algol\RutgersAlgol68 is assumed here) and named '''postlude.r68'''.
Line 397:
'''Note''' that ^E^O^F should be replaced with the seuence of characters control-E, control-O and control-F.
 
<langsyntaxhighlight lang=algol68> 'end'
'end'
^E^O^F</langsyntaxhighlight>
3,021

edits