Fixes in 1991/dds/README.md
Remove the 2>/dev/null as that is no longer needed as the code was updated a while ago to use fgets() in the enciphered string (the output program used gets() but now it uses fgets()). Format and typo fix README.md. I believe this completes 1991/dds.
This commit is contained in:
1 parent
d22dca5b0a
commit
cb9d7a297c
1 file changed
+24
-23
+24
-23
@@ -8,7 +8,7 @@ make all
|
|||||||
## To use:
|
## To use:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./dds basic_program 2>/dev/null
|
./dds basic_program
|
||||||
./a.out 2>/dev/null
|
./a.out 2>/dev/null
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -18,14 +18,17 @@ make all
|
|||||||
The author suggests trying:
|
The author suggests trying:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./dds LANDER.BAS 2>/dev/null
|
./dds LANDER.BAS
|
||||||
./a.out 2>/dev/null
|
./a.out
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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)?
|
||||||
|
|
||||||
What happens if you give the program a C program like itself? Try:
|
What happens if you give the program a C program like itself? Try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./dds dds.c 2>/dev/null
|
./dds dds.c
|
||||||
```
|
```
|
||||||
|
|
||||||
You'll get errors yes but what does the generated file look like? What about
|
You'll get errors yes but what does the generated file look like? What about
|
||||||
@@ -34,9 +37,6 @@ other types of files?
|
|||||||
|
|
||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
|
|
||||||
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
|
This obfuscated program translates BASIC programs into obfuscated
|
||||||
C programs by way of an obfuscated algorithm.
|
C programs by way of an obfuscated algorithm.
|
||||||
|
|
||||||
@@ -45,15 +45,16 @@ C programs by way of an obfuscated algorithm.
|
|||||||
|
|
||||||
This program is a companion to the [DDS-BASIC interpreter
|
This program is a companion to the [DDS-BASIC interpreter
|
||||||
program](/1990/dds/README.md) that was submitted to [the contest in
|
program](/1990/dds/README.md) that was submitted to [the contest in
|
||||||
1990](/years.html#1990). This compiles BASIC programs into executable commands.
|
1990](/years.html#1990). This compiles BASIC programs into compilable C code
|
||||||
The input format is almost identical to the input format of the DDS-BASIC
|
and then compiles it. The input format is almost identical to the input format
|
||||||
interpreter. The program needs an executable C compiler called `cc` in your
|
of the DDS-BASIC interpreter. The program needs an executable C compiler called
|
||||||
path in order to work.
|
`cc` in your path in order to work.
|
||||||
|
|
||||||
|
|
||||||
### Program commands:
|
### Program commands:
|
||||||
|
|
||||||
|
|
||||||
- variable names A to Z
|
- variable names `A` to `Z`
|
||||||
- FOR var = exp TO exp
|
- FOR var = exp TO exp
|
||||||
- GOSUB exp
|
- GOSUB exp
|
||||||
- GOTO exp
|
- GOTO exp
|
||||||
@@ -75,7 +76,7 @@ Many system calls and C library calls can be used.
|
|||||||
|
|
||||||
- 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.
|
||||||
- Exactly one space is needed after the FOR and NEXT tokens
|
- Exactly one space is needed after the `FOR` and `NEXT` tokens.
|
||||||
- ALL INPUT MUST BE UPPERCASE.
|
- ALL INPUT MUST BE UPPERCASE.
|
||||||
|
|
||||||
### Error checking / error reports:
|
### Error checking / error reports:
|
||||||
@@ -85,19 +86,19 @@ Other errors may produce errors in later phases of the compilation.
|
|||||||
|
|
||||||
### Can you figure out how the compiler works?
|
### Can you figure out how the compiler works?
|
||||||
|
|
||||||
Hint:
|
#### Hint:
|
||||||
|
|
||||||
The compiler is NOT written in C, so this is really a meta-obfuscated
|
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
|
program. The C code is an interpreter for the four register, seven
|
||||||
instruction COGNIMP$ machine that is contained in the `s` string.
|
instruction `COGNIMP$` machine that is contained in the `s` string.
|
||||||
(COGNIMP$ is named after the symbolic names of the seven instructions it
|
(`COGNIMP$` is named after the symbolic names of the seven instructions it
|
||||||
defines (Print Output Goto Match If, iNcrement and Copy). The `$` sign
|
defines (`Copy`, `Output`, `Goto`, `iNcrement`, `If`, `Match` and `Print`).
|
||||||
is used for labels.) The actual compiler is written in COGNIMP$.
|
|
||||||
Browsing through the COGNIMP$ code we encourage you to examine the
|
The `$` sign is used for labels. The actual compiler is written in `COGNIMP$`.
|
||||||
loops for scanning the expression in the IF statement and the way a
|
Browsing through the `COGNIMP$` code we encourage you to examine the loops for
|
||||||
decision tree is implemented in order to match the statements. (Of
|
scanning the expression in the `IF` statement and the way a decision tree is
|
||||||
course the `s` string is encoded by adding one to every character of it just
|
implemented in order to match the statements. (Of course the `s` string is
|
||||||
to confuse you).
|
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:
|
||||||
|
|||||||
Reference in new issue
Block a user