SYMSYN Symsyn is a simple syntax, back-to-basics, minimalist programming language which resembles a sort of assembly language for a Pascal Virtual Machine (PVM). Assemblers provide a one to one relationship between a mneumonic instruction and a hardware opcode. Similarly, Symsyn establishes a one to one relationship between an instruction and a Pascal procedure. The instruction set is, therefore, open ended and can grow into any operating environment. It is implemented by a compiler, SSL which generates version specific PVM code from a text file. The code can be run by either SSS or SSX. SSS runs a single prog to completion and then ends. SSX runs each prog in a multitasking environment and has program monitoring and log functions. Multitasking is enhanced with several inter-program communication instructions which provide synchronization and data passing capability. The intended user is a novice programmer or a non programmer who doesn't have the time or interest to learn the conceptual niceties and abstract concepts of a more advanced and rigorous language, but needs to accomplish a given task. Symsyn's simplicity and potential could provide much of the functionality of Pascal without all of Pascal's discipline and could be an on ramp to learning Pascal.
HISTORY
A compiler and emulator were written for the PC under DOS to enable it to run multitasking software originally written for an IBM Series/1. The software drove legacy data communications protocols, code translation, encryption support, and transaction flow control for a real time banking application involving ATM's, teller terminals, and regional switches. This front end and a host computer were capable of controlling hundreds of devices. While Symsyn is decidedly different from that source code, major portions of that compiler and emulator were used here. FEATURES
THE LANGUAGE
As much as possible examples will be used to explain the syntax. But first, some basic principles.
There are three data types.
EXAMPLES
In the following examples, identifiers starting with
C : 'This is a character string' D : 40 ' ' | character string of 40 spaces C2 : X'ABCD1234567890' | string of hexadecimal digits X : 3 1000 | three word integer array with a value of 1000 X1 : 0XABCDEF | integer with a hexadecimal value of ABCDEF X2 : 0b100101 | integer with a binary value of 100101 RX : 0.0 | real with a value of 0
Y : @C | integer with a value equal to the address of C
Y1 : #C | integer with a value equal to the size of C CEQ = X | CEQ points to X as a character string X | set X to zero
+ X | increment X by 1
+ 0XA9822B Y | add hex value to Y
X Y | move X to Y
X:3:4 Y | move 4 bits starting with bit number 3 to Y
C $S | move the character string C to the ansi string $S
$S C #C | move (size of C) characters from ansi string $S to C
C D N | move N characters from C to D
+ 'ABC' $S | add character string 'ABC' to the end of ansi string $S
#$S X | move the size of string $S to X
X.I Z | move the Ith word in array X to Z
| the if clause
if i LT 1000
.
. . endif
| becomes a 'while' clause with the addition of a 'goif' instruction
if i LT 1000
.
. . goif
endif| and becomes an iterative 'for' loop with the addition of an index variable
i
if i LT 1000
.
. . + i
goif
endif| time a loop and display the result on the console datetime strt | system date and time to strt I
if I < 100000000
+ I goif endif datetime stopp | system date and time to stopp msbetween strt stopp rslt | milliseconds between strt and stopp ~ rslt $s | convert binary to decimal string $s [] | display result | read a text file and display it on the console opentext 'sorttext.txt' fid if ioresult eq 0 | ioresult = -1 at end of file [fid] $s | move a record from the file to the string $s [] | display string on the console goif endif | read a number from the console add 1 and display the result LP [] $S | read from console IF $S <> '' | if something was entered ~ $S X | convert to binary + X | add 1 X [] | output to console GO LP | go to lp ENDIF | using the haversine formula compute the distance in kilometers from Nashville to | Los Angeles given the latitude and longitude of each lat1 : 36.12 lon1 : -86.67 lat2 : 33.94 lon2 : -118.4 dx : 0. dy : 0. dz : 0. kms : 0. {degtorad(lon2 - lon1)} lon1 {degtorad lat1} lat1 {degtorad lat2} lat2 {sin lat1 - sin lat2} dz {cos lon1 * cos lat1 - cos lat2} dx {sin lon1 * cos lat1} dy {arcsin(sqrt(dx^2 + dy^2 + dz^2)/2) * 12745.6} kms "'Haversine distance: ' kms ' kilometers'" [] |