Format fixes in 1991/dds/README.md

This commit is contained in:
Cody Boone Ferguson committed 2023-04-09 08:29:29 -07:00
1 parent 1c8452c4ed
commit b79d7276b3
1 file changed
+47 -34
+47 -34
View File
@@ -1,20 +1,24 @@
# Most Well Rounded:
Diomidis Spinellis
Imperial College, University of London
Myrsinis 1
GR-145 62 Kifissia
Greece
Diomidis Spinellis
Imperial College, University of London
Myrsinis 1
GR-145 62 Kifissia
Greece
## To build:
make all
```sh
make all
```
## To run:
./dds basic_program
./a.out
```sh
./dds basic_program
./a.out
```
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed some segfaults in
this entry as well as making it so `a` (was `a.out`, see below) can be generated
@@ -77,10 +81,9 @@ Thank you Cody for your assistance!
## Judges' comments:
## Try:
Notice that a file a.c has been generated. Can you tell how a.c was
produced? How does a.c relate to LANDER.BAS?
Notice that a file `a.c` has been generated. Can you tell how `a.c` was
produced? How does `a.c` relate to [LANDER.BAS](LANDER.BAS)?
This obfuscated program translates BASIC programs into obfuscated
C programs by way of an obfuscated algorithm.
@@ -89,28 +92,36 @@ NOTE: Due to minor problems with some strict ANSI C compilers, we
have supplied a more portable ANSI version.
## Author's comments
## Author's comments:
This program is a companion to the DDS-BASIC interpreter program that
was submitted to the contest in 1990. This compiles BASIC programs into
executable commands. The input format is almost identical to the input
format of the DDS-BASIC interpreter. The program needs an executable C
compiler called `cc' in your path in order to work.
compiler called `cc` in your path in order to work.
Program commands:
### Program commands:
variable names A to Z variables initialized to 0 on RUN
FOR var = exp TO exp NEXT variable
GOSUB exp RETURN
GOTO exp IF exp THEN exp
INPUT variable PRINT string
PRINT exp var = exp
REM any text END
- variable names A to Z
- FOR var = exp TO exp
- GOSUB exp
- GOTO exp
- INPUT variable
- PRINT exp
- REM any text
- variables initialized to 0 on RUN
- NEXT variable
- RETURN
- IF exp THEN exp
- PRINT string
- var = exp
- END
Expressions are the same as the expressions of the C language.
Many system calls and C library calls can be used.
Input format:
### Input format:
- Free format positioning of tokens on the line.
- No space is allowed before the line number.
@@ -122,19 +133,21 @@ Error checking / error reports:
The compiler silently ignores many errors.
Other errors may produce errors in later phases of the compilation.
Can you figure out how the compiler works? Hint:
### Can you figure out how the compiler works?
The compiler is NOT written in C, so this is really a meta-obfuscated
program. The C code is an intepreter for the four register, seven
instruction COGNIMP$ machine that is contained in the s string.
(COGNIMP$ is named after the symbolic names of the seven instructions it
defines (Print Output Goto Match If, iNcrement and Copy). The $ sign
is used for labels.) The actual compiler is written in COGNIMP$.
Browsing through the COGNIMP$ code we encouriage you to examine the
loops for scanning the expression in the IF statement and the way a
decision tree is implemented in order to match the statements. (Of
course the 's' string is encoded by adding one to every character of it just
to confuse you).
Hint:
The compiler is NOT written in C, so this is really a meta-obfuscated
program. The C code is an interpreter for the four register, seven
instruction COGNIMP$ machine that is contained in the `s` string.
(COGNIMP$ is named after the symbolic names of the seven instructions it
defines (Print Output Goto Match If, iNcrement and Copy). The `$` sign
is used for labels.) The actual compiler is written in COGNIMP$.
Browsing through the COGNIMP$ code we encourage you to examine the
loops for scanning the expression in the IF statement and the way a
decision tree is implemented in order to match the statements. (Of
course the `s` string is encoded by adding one to every character of it just
to confuse you).
## Copyright and CC BY-SA 4.0 License: