Human Words

From Esolang
Jump to navigation Jump to search

Human Words is a Formal LOLCODE.

Syntax and Command

Commands
Start program with version [version]. In fact, I don't even have to write what to execute every piece of code.
#Exegesis: [comment] 示例
#Multiline exegesis:
[comment]
#End of exegesis.
示例
It needs [library]. 示例
Output [string]. 示例
Input [variables] (with [prompt] as a prompt). 示例
Define a variable [name]. This command defines a void variable.
Define a variable [name] and set its type to [type]. The types can be int, float, string, bool, char, etc.
Define a variable [name], set its type to [type] and initalize it to [value]. 示例
Set [variable]'s value to [value]. 示例
Set [variable]'s type to [type]. 示例
Real True
Fake False
A+B or A plus B 示例
A-B or A minus B 示例
A*B or A times B 示例
A/B or A divide by B 示例
A%B or A modulo B 示例
A^B or A to the power B 示例
A=B or A equals to B 示例
A!=B or A not equals to B 示例
A>B or A bigger than B 示例
A<B or A smaller than B 示例
A>=B or A isn't smaller than B 示例
A<=B or A isn't bigger than B 示例
!A or Not A 示例
A&B or A and B 示例
A|B or A or B 示例
If expr then: 示例
Else: 示例
Else if expr then: 示例
Endif. 示例
Repeat these code 10 times 示例
Repeat these code until expr is fake: 示例
Repeat these code forever: 示例
Skip this round of loop. 示例
Terminate the loop. 示例
Excludes [library]. 示例
Define a class named [name].> 示例
Define a function called [function_name] with the arguments [*args, **kwargs]. 示例
Return [value]. 示例
Nothing None in Python
Kill program. 示例
etc. etc.

Programs

Hello, world

Start program with version 2,1,5.
Output "Hello, world!".
Kill program.

Even or Odd

Start program with version 2,1,5.
Define a variable A and set its type to BigNumber.
Input A.
If A%2=0 then:
    Output "It is an even.".
Else: 
    Output "It is an odd.".
Endif.
Kill program.

Complex Example

Start program with version 2,1,5.
Define a class named pile.
	Define a new object length, set its type to BigNumber and initalize it to 0.
	Define a new object max, set its type to BigNumber and initalize it to -1.
	Define a new object top, set its type to BigNumber and initalize it to the value of length.
	Define a new object cur_stack, set its type to BigNumber List[Unlimited] and initalize it to {Nothing}.
	
	Define a void static called Push with the arguments [element]. 
		If my.top >= my.length then: 
			Output "Overflow!".
		Else: 
			Increases the top.
			Set cur_stack[top] to element.
		Endif.
	End.
	Define a AnyType static called Pop with the arguments [temp].
		If my.top <= 0 then:
			Output "Underflow!".
		Else:
			Set temp to cur.stack[top].
			Set cur.stack[top] to Nothing.
			Decreases the top.
			Returns temp.
		Endif.
	End.
	Define a BigNumber static called GetLength with no arguments.
		Returns my.length.
	End.
End.

Define a variable stack and set its type to pile.

Do (stack.push(8)).
Do (stack.push(5)).
Do (stack.push(3)).
Do (stack.push(2)).
Do (stack.push(1)).
Do (stack.push(1)).
Output "The first 6 numbers in fibonacci sequence is: "
Repeat 6 times:
	Output the value of (stack.pop).
	Output " ".
Endcycle.

Kill program.


See also

Categories