Snakel

From Esolang
(Redirected from Snakel (Ractangle))
Jump to navigation Jump to search
Official logo since 2005

Snakel is an alternative universe version of Python created in 1989 by Tolly Edd in the gammaline universe

Compatibility methods

Snakel can't suport EVERY operating system due to some issues by either with hardware or by something else. This page tells the ways to make Snakel compatible with your OS (Like Ultium)

Computers

Ultium

Method Disk system hardware "New" hardware Moddern hardware
Official Snakel add-on Yes, but in Ultium 2.0 to Ultium 3.0 No, since thoss Ultium computers don't have add-on slots
Using a coding extension of Snakel No Yes
Using the "Beginner-Friendly Programming Tool" No Somewhat stable Yes
Using the codefree.com/recodefree.com website Yes but only in Ultium 2.0 to 3.0 since they contain the internet feature Yes

Syntax

Every program starts with a definition, to actually define a function, you can do this:

­ 1: def name[arguments]; !Used for argumented functions
­ 2: ­ ­ ­ ­ ignore !"ignore" will go to the end of the function
­ 3: def name:none; !Used for argumentless functions
­ 4: ­ ­ ­ ­ ignore

translated into python:

def name(arguments):...
def name():...

I/O in Snakel also exist:

­ 1: def main:none;
­ 2: ­ ­ ­ ­ tell["anything here"] !Prints "anything here" in one line
­ 3: ­ ­ ­ ­ user !Gets user input. No argument required

translated into python:

print("""anything here""")
input()

By the way. The strings are actually multi-liners so:

­ 1: def main:none;
­ 2: ­ ­ ­ ­ tell["multi
­ 3: line"] !Will print "multi\nline"

translated into python:

print("""multi
line""")

Now let's talk about the "ignore" and "end".

­ 1: !we already know that "ignore" goes to the end of the function, But did you know that you can also ignore errors with "ignore" and with "test"?
­ 2: test:1/0 !Will rasie a zero devision error
­ 3: ignore Error:tell["inf"] !will print "inf" (or infinity) instead of raising zero devision error
­ 4: end !"end" just ends the program

translated into python:

try:1/0
except:print("""inf""")
exit()

Also i think i kinda stole the logic of rust's case statements for Snakel conditional

­ 1: num i=0
­ 2: if i=0;tell[0] | i=1;end | tell[3]

translated into python:

i:int=0
if i==0:print(0)
elif i==1:exit()
else:print(3)

Snakel also has the feature of making multiple files in one file (just like in DreamBerd). You can also import that file to another file as a internal module

­ 1: -one.sl-
­ 2: tell["executed one.sl"]
­ 3: -two.sl-
­ 4: import mod one.sl
­ 5: tell["executed two.sl"]

Errors

This is still a work in progress. It may be changed in the future.

If you make an error in the code (for example putting an undefined variable into the code) in a Snakel interpreter. Then the terminal (or emiter as it's called in the gammaline universe) will emit an error and will explain and show where you made a mistake

TypeError

Using a wrong type in a variable

code:

­ 1: !for example
­ 2: num a="eso"

emiter:

­ Current operation stopped
­ Error type:TypeError
­ At what line:line 2
­ Explanation:
­ 2: num a="eso"
­ ­ ­ ­ ­ ­ ­ ­ ­ ­ -----
­ Wrong value type. num is used as a's type, str was used instead

Not specifying a type or specify a non-existent type to a variable

code:

­ 1: i=user

emiter:

­ Current operation stopped
­ Error type:TypeError
­ At what line:line 1
­ Explanation:
­ 1: i=user
­ ­ ­ ­ ^
­ Invalid type. "" is not a "Type"

Removing an entry that is not on the list

code:

­ 1: l=["H","I"]
­ 2: entry.pop(l,"!")

emiter:

­ Current operation stopped
­­ Error type:TypeError
­­ At what line:line 2
­­ Explanation:
­­­ 2: entry.pop(l,"!")
­­­ ­­ ­­ ­­ ­­ ­­ ­­ ­­ ­­ ­­ ­­ ­­ ­­ ­­ ­­ ­­ ­---
­­ Pop non-related entry from list. "!" is not an element on list "l"

SyntaxError

Using anything BUT a tab/4 spaces as indentation

code:

­ 1: def main:none;
­ 2: ;tell["how"]

emiter:

­ Current operation stopped
­­ Error type:SyntaxError
­­ At what line:line 2
­­ Explanation:
­ 2: ;tell["how"]
­­­ ­­ ­­ ­ ­­^
­­ Invalid indentation. A tab or 4 spaces must be used as the indentation, ";" was used instead


Examples

Hello, world!

­ 1: def main:none;tell["Hello, world!\n"]

translated into python:

print("Hello, world!")

Cat program

­ 1: def main:none;tell[user]

translated into python:

print(input())

Truth-machine

­ 1: def truth:none;
­ 2: ­ ­ ­ ­ num i=user
­ 3: ­ ­ ­ ­ if i>0;ignore | tell[0];end
­ 4: def main:none;
­ 5: ­ ­ ­ ­ truth[]
­ 6: ­ ­ ­ ­ while 1:tell[1]

translated into python:

def truth():
    i:int=input()
    if int(i)>0:return
    else:print(0);exit()
truth()
while 1:print(1,end="")

A+B Problem

­ 1: def APB [num[a,b]];tell[a+b]
­ 2: def main:none;APB[7,4]

translated into python:

def APB (a:int,b:int):print(a+b)
APB(7,4)

See also

Bake - The language made before the first version of Snakel was uploaded