Ever wanted to program in a programming language that's more of a pain in the @ss than brainf*ck?
Ever wanted to experience near-infinite levels of frustation?
If so, welcome to scoop
Note: before beginning, please check the programming style document
The idea behind this project was hey, what if there was a programming language that used an 8bit unsigned integer as the ONLY variable?
Meet a
, the only variable (It's named a
because I didn't want to name it Jimmy), whose values must be within the range of 0-255.
The thing is, a programming language that does nothing... well... kinda sucks. So, to make it suck even more better, we can assign values to a
Let's see some instructions: (Note that 'number' does not mean literally the word number, it's just an integer)
add number
: Adds number toa
, (C/C++ equivalent: a += number;) (Ex:add 15
)substract number
: Substracts number froma
, (C/C++ equivalent: a -= number;) (Ex:substract 3
)min
: Setsa
to 0max
: Setsa
to 255set number/char
: Setsa
to the number or to the ASCII value of the char (Ex:set 120
)input
: Will wait for user input and will seta
to its value. Note that it must be either an ASCII character or a 0-255 integerrandom lower higher
: Setsa
to a random value betweenlower
andhigher
Ok, so this seems pretty easy, for now, but, hey, how the heck do we output these values?
There are a whole 3 instructions to get output in scoop:
show
: prints the value ofa
in the form of a number. (Literally just cout'sa
) (Ex:set 120 show
(Will print120
in the console))print
: prints the ASCII character ofa
. (Literally justcout << (char)a;
) (set a print
(Will printa
in the console))printline
: does the same asprint
but also prints a newline
But making programs that only print something are pretty boring, don't you think?
What if I want to ask scoop to check conditions?
In scoop we have the simple conditional, if
.
The thing is, its working mechanisms are very different from the one a normal programmer is accustomed to.
First of all, the syntax is:
- if condition instructions endif
where condition
may be:
- >= number
: checks if a
is greater or equal to number
- == number
: checks if a
is equal to number
- <= number
: checks if a
is less or equal to number
- < number
: checks if a
is less than number
- > number
: checks if a
is greater than number
- != number
: checks if a
is different from number
So far, so good, but here's the first thorn in the butt:
There's no else
nor else if
. It's not that difficult to put nested if's...or not.
First rule of nested if
s in scoop: only one endif
is written in the whole block
It can be better seen with an example:
if >= 3
if <= 7
show
endif
Failing to do so will result in Error: command not recognized
Ok, we've seen the conditionals, now we'll see the loops.
There's only one: while
Its syntax is: while condition instructions endwhile
As with if
, there's only one endwhile
needed
And the conditions are the same as with if
Example:
while <= 128
show
add 1
endwhile
Note: There's no break
equivalent, for added insanity
A loop that always runs: while >= 0
, as a
will return to 0
if assigned 256
. You can even change the value of a
in the loop!
Example:
while >= 0
print
add 1
endwhile