Files
ioccc/1991/dds
Landon Curt Noll c457b16358 fix all HTML headers
Renamed `ioccc.ico` to `favicon.ico`.

Correctly added use of `favicon.ico` to all constructed HTML headers.
Fixed the smart quote in HTML elements problem.

Moved HTML "DO NOT EDIT" comments down below at the bottom of the
HTML phase 1 section.  According to to the Nu Html Checker, a charset
attribute on a meta element found after the first 1024 bytes.

Changed `bin/md2html.sh` VERSION from "1.1.3 2024-03-28"
to "1.2 2024-03-30".

Improved `bin/gen-status.sh` to adjust the "status_update" value
only when the "contest_status" is changed.

Performed a `make www` to perform and test the above under macOS.
2024-03-30 22:21:45 -07:00
..
2024-03-29 08:02:01 -07:00
2023-11-10 11:16:51 -08:00
2023-07-06 21:49:38 -07:00
2024-03-30 22:21:45 -07:00
2023-10-21 10:47:53 -07:00
2024-03-13 00:38:46 -07:00
2024-03-20 00:19:52 -07:00

To build:

make all

To use:

./dds basic_program
./a.out 2>/dev/null

Try:

The author suggests trying:

./dds LANDER.BAS
./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?

What happens if you give the program a C program like itself? Try:

./dds dds.c

You'll get errors yes but what does the generated file look like? What about other types of files?

Judges' remarks:

This obfuscated program translates BASIC programs into obfuscated C programs by way of an obfuscated algorithm.

Author's remarks:

This program is a companion to the 1990/dds 1990 DDS-BASIC interpreter program. This compiles BASIC programs into compilable C code and then compiles it. 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.

Program commands:

  • 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:

  • Free format positioning of tokens on the line.
  • No space is allowed before the line number.
  • Exactly one space is needed after the FOR and NEXT tokens.
  • ALL INPUT MUST BE UPPERCASE.

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:

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 (Copy, Output, Goto, iNcrement, If, Match and Print).

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).