-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Welcome to MeowScript!
This wiki will teach you how to write MeowScript but be careful, this wiki is written for people who have already programmed before.
If you haven't consider reading the book instead! (Link coming later)
MeowScript is
- interpreted
- dynamic typed
- lexical scoped
- object oriented
- procedural
- structured
- half context free
- lazy
- unbiased
A line comment is started´ with a #
and a multi line comment begins and ends with a ##
A basic number. Can hold negative as well as floating point numbers
12
42.001
(-54.13)
A list of characters that can also handle escape sequences.
(has nothing to do with type List
)
"Hello, "
"World!\n"
" \rsomething something\t\t "
List of escape sequences:
-
\n
-> Newline -
\r
-> Carry return -
\t
-> Vertical tab -
\\
-> Normal backslash
A dynamic list that can hold any amount of elements of the VariableType
subset.
[1,2,3]
["This"," is ","a list!"]
[[1,2],[3,4],[5,6]]
[1,"2",[3]]
A map of keys and values of any type.
{
"key" = 12,
key2 = "woo",
"shopping list" = ["salad","bread","cookies"],
subdic = {
1 = 2,
"a" = b
},
}
Any name that has been used previously to define a function.
A built in command name.
A code snippet that has been put into curly braces. ({}
)
{code that does stuff; ...}
Any set of characters that follows these rules:
- First character is not a number
- Rest is either
A-Z
,a-z
,0-9
or_
a_Name
am2cool4u
sTufF
A sequence of mathematical terms following the rule of:
(left operator right)
.
(1 + 2 * 3 == 9)
(42.2 / (3 - 2.2))
A list or values, compounds and expressions that is inbetween two braces (()
).
(12.3,"hi",[1,2,3])
({...},(12*23),(-44.6))
()
Similar to an Argumentlist
but with more restrictions.
Used as parameter lists for functions.
(a :: Number, b, c :: String)
(a,b,c)
()
A combination of only special characters that is in the list of known operators.
==
+
-
^
A loaded module that can be used to call methods on or to be enabled. In the standard library are three:
os
filesystem
math
But others can be added at runtime by the user.
An already defined structure in either the current or in a scope below the current.
A object is an instance of a struct. It has no literal.
An defined event by the event
command. No literal.
Some reserved words used by MeowScript to ensure that some names don't get used as function names.
public
private
occur_only
There are some subsets of the main set of types.
Any type that a variable can hold. This includes:
- Number
- String
- List
- Dictionary
- Object
Any type that can be methods be called on. This includes:
- List
- Dictionary
- Object
- Module
MeowScript executes line by line, but things that are in braces counts still as one line.
command argument1 argument2 {
....
} () ...
An argument can be type.
There are also commands that use an unspecified amount of arguments.
Everything in MeowScript returns something, even if it's just void
.
If something gets returned that is not void
some rules are to be considered:
- If we are in the main scope, the return value will be printed to the console.
- If we are not the in main scope and there are more lines with commands still to come, we ignore it.
- If we are not in the main scope and there are no more lines with commands left, we return down the current return.
Compounds, if they aren't used as body of something (a function for example), run their context and return the their result down, may it even be void
.