Ruined BASIC
Jump to navigation
Jump to search
Ruined BASIC is an overly simplified BASIC dialect invented by User:A in order to break what people think of BASIC (a very easy to use language).
Documentation
In practical programs, the only constant that can appear is the constant 1. All variables are set to 0. Variable names were limited to A to Z (which stores integers, non case-sensitive), giving a maximum of 26 possible distinct variables.
rem rem: Comments rem Example 10 rem Stops rem let: Initialize ariables rem Structure: let variable expression rem This sets the variable to variable - expression. 10 let A 123 rem if: Conditional statements. Checks if the variable A is equal to 0. rem Structure: if expression line-number rem Expressions in if statements can only contain one lexical item. 20 if 40 rem There is an alternate version if var 40, which is what all examples use. rem input: input A from the keyboard 30 input rem print: Output A to console 40 print
Example programs
10 input A 20 if 70 30 let B 10 40 let A B 50 print A 60 if z 10 70
rem Uncondtional jump simulator rem This simulation jumps to line 12. rem make sure that the accumulator a was 0. 11 if 12 12 rem goes to here. 13
Cat program(limited to integers)
10 input a 20 if a 50 30 print a 40 if z 10 50
Copying values
10 rem This copies the value of z to a. 20 let b b 30 let b z 40 let a a 50 let a z
Computational class
It could be compiled to the Minsky machine with 2 registers quite easily. Make sure that there are line numbers.
INC a, b := let c 1 let a c rem sets a -> z (preserves a) let j j let j a let z z let z a rem sets a to 0 let a a rem jump! if b Recovery process: rem copies the content of z to a (recovering a) let j j let j z let a a let a z JZDEC a, b, c := rem TODO let a 1 if b rem preserves a let j j let j a let z z let z j let a a if c Recovery process: rem copies the contents of z to a rem copies the content of z to a (recovering a) let j j let j z let a a let a z