Skip to content

Latest commit

 

History

History
97 lines (75 loc) · 3.68 KB

Programming_guide.md

File metadata and controls

97 lines (75 loc) · 3.68 KB

Preface

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

Scoop - The programming language with just one variable

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.

Assigning values

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 to a, (C/C++ equivalent: a += number;) (Ex: add 15)
  • substract number: Substracts number from a, (C/C++ equivalent: a -= number;) (Ex: substract 3)
  • min: Sets a to 0
  • max: Sets a to 255
  • set number/char: Sets a to the number or to the ASCII value of the char (Ex: set 120)
  • input: Will wait for user input and will set a to its value. Note that it must be either an ASCII character or a 0-255 integer
  • random lower higher: Sets a to a random value between lower and higher

Ok, so this seems pretty easy, for now, but, hey, how the heck do we output these values?

Output

There are a whole 3 instructions to get output in scoop:

  • show: prints the value of a in the form of a number. (Literally just cout's a) (Ex: set 120 show (Will print 120 in the console))
  • print: prints the ASCII character of a. (Literally just cout << (char)a;) (set a print (Will print a in the console))
  • printline: does the same as print 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?

Conditionals

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 ifs 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

Loops

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

Tricks

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