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: # Most Well Rounded:
Diomidis Spinellis Diomidis Spinellis
Imperial College, University of London Imperial College, University of London
Myrsinis 1 Myrsinis 1
GR-145 62 Kifissia GR-145 62 Kifissia
Greece Greece
## To build: ## To build:
make all ```sh
make all
```
## To run: ## To run:
./dds basic_program ```sh
./a.out ./dds basic_program
./a.out
```
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed some segfaults in [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 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: ## Judges' comments:
## Try:
Notice that a file a.c has been generated. Can you tell how a.c was 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? produced? How does `a.c` relate to [LANDER.BAS](LANDER.BAS)?
This obfuscated program translates BASIC programs into obfuscated This obfuscated program translates BASIC programs into obfuscated
C programs by way of an obfuscated algorithm. 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. 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 This program is a companion to the DDS-BASIC interpreter program that
was submitted to the contest in 1990. This compiles BASIC programs into was submitted to the contest in 1990. This compiles BASIC programs into
executable commands. The input format is almost identical to the input executable commands. The input format is almost identical to the input
format of the DDS-BASIC interpreter. The program needs an executable C 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 - variable names A to Z
GOSUB exp RETURN - FOR var = exp TO exp
GOTO exp IF exp THEN exp - GOSUB exp
INPUT variable PRINT string - GOTO exp
PRINT exp var = exp - INPUT variable
REM any text END - 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. Expressions are the same as the expressions of the C language.
Many system calls and C library calls can be used. Many system calls and C library calls can be used.
Input format: ### Input format:
- Free format positioning of tokens on the line. - Free format positioning of tokens on the line.
- No space is allowed before the line number. - No space is allowed before the line number.
@@ -122,19 +133,21 @@ Error checking / error reports:
The compiler silently ignores many errors. The compiler silently ignores many errors.
Other errors may produce errors in later phases of the compilation. 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 Hint:
program. The C code is an intepreter for the four register, seven
instruction COGNIMP$ machine that is contained in the s string. The compiler is NOT written in C, so this is really a meta-obfuscated
(COGNIMP$ is named after the symbolic names of the seven instructions it program. The C code is an interpreter for the four register, seven
defines (Print Output Goto Match If, iNcrement and Copy). The $ sign instruction COGNIMP$ machine that is contained in the `s` string.
is used for labels.) The actual compiler is written in COGNIMP$. (COGNIMP$ is named after the symbolic names of the seven instructions it
Browsing through the COGNIMP$ code we encouriage you to examine the defines (Print Output Goto Match If, iNcrement and Copy). The `$` sign
loops for scanning the expression in the IF statement and the way a is used for labels.) The actual compiler is written in COGNIMP$.
decision tree is implemented in order to match the statements. (Of Browsing through the COGNIMP$ code we encourage you to examine the
course the 's' string is encoded by adding one to every character of it just loops for scanning the expression in the IF statement and the way a
to confuse you). 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: ## Copyright and CC BY-SA 4.0 License: