small readme update
This commit is contained in:
parent
e7a7d05e64
commit
6eb4e21263
28
README.md
28
README.md
@ -8,11 +8,6 @@ This is the repo for the Mako language spec. This is a reference parser, and its
|
|||||||
C-style multiline comments
|
C-style multiline comments
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
The language's intent and design should mimic Lua as much as possible.
|
|
||||||
There is a global table that is accessible, but all variables are implicitly
|
|
||||||
local.
|
|
||||||
*/
|
|
||||||
var = 2 // in the global scope
|
var = 2 // in the global scope
|
||||||
var2 = 4 // also in global scope
|
var2 = 4 // also in global scope
|
||||||
echo var + var2 // outputs 6
|
echo var + var2 // outputs 6
|
||||||
@ -24,16 +19,13 @@ fn function_name(arg1, arg2)
|
|||||||
return var5
|
return var5
|
||||||
end
|
end
|
||||||
|
|
||||||
/*
|
|
||||||
Tables work like lua but are ordered hash maps in implementation, and coerced to arrays
|
|
||||||
if it makes sense to do so. Trailing comma is optional
|
|
||||||
*/
|
|
||||||
var6 = {
|
var6 = {
|
||||||
table1 = "foo",
|
table1 = "foo",
|
||||||
"table2" = 42,
|
"table2" = 42,
|
||||||
240 = anothertable
|
240 = anothertable
|
||||||
}
|
}
|
||||||
var6[lol] = "foo"
|
var6[lol] = "foo"
|
||||||
|
echo var6.table1 // "foo"
|
||||||
|
|
||||||
if condition then
|
if condition then
|
||||||
// do stuff
|
// do stuff
|
||||||
@ -46,5 +38,21 @@ end
|
|||||||
var7 = condition ? left : right
|
var7 = condition ? left : right
|
||||||
|
|
||||||
for k, v in any_table do
|
for k, v in any_table do
|
||||||
// ordered hash map, so ipairs/pairs not necessary
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for i = 10, 100, 10 do
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 1, 10 do
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
while true do
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
exit "print before exiting 0"
|
||||||
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user