forked from renaudbedard/MuteGrammar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
old_demo.mute
112 lines (86 loc) · 2.18 KB
/
old_demo.mute
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
a[5] # a = 5
b(a>4)[5] # if(a > 4){b = 5;}
b(a>4)[5]{c[5]}# if(a > 4){b = 5; c = 5;}
{"Hello World"} # Hello world
["Hello world"]{$} # Hello world
[World]{"Hello @1",$} # Hello world
a[2]
b(a>1){"Hello World"} # Hello world (for a = 2)
a[0,1,2,3] # This list/array has the name "a"
b{"Third number: @1",a.2} # 2
a{"Third number: @1",$.2} # 2, a line calling itself can use $ for self
b($ > 1){"Hello World"}
a[4]($ > a.1){b[3]} # Hello World, this sets b[x] with value of 3
a[4]($ > a.1){b.3} # {null}, this gets the 3rd value of b[], i this case, null
# start
<system>[logs:on,memory:on]
# hello world
{"hello world"}
{"<br />"}
# variable
flyer[5]
# inline declaration
novel[25]{"novel pages: @",novel}
{"<br />"}
# named variable
book[page:5]
# using variable
{"page value: @",book.page}
{"<br />"}
# conditional cases
(book.page > 3){"book is greater than 3"}
{"<br />"}
# conditional variables
flyer[pages:35](book.page > 3)
(book.page > 3){"flyer pages: @",flyer.pages}
{"<br />"}
# self shorthand values
leaflet[pages:4]{"Leaflet pages: @",$.pages}
{"<br />"}
# random values
dictionary[pages:5~10]{"Dictionary pages: @",$.pages}
{"<br />"}
# inline operation
panflet1[5*5]
panflet2[10-5]
{"Values: @, @",panflet1,panflet2}
{"<br />"}
# combine strings
first[foo]
second[bar]
topic[foo&bar]{"Topic: @",$}
{"<br />"}
# multiple conditions
collection1(flyer.pages > 15)(5>1){"Solved<br />"}
# multiple operations
collection2{"First Collection<br />"}{"Second Collection<br />"}
# if (same as conditional variables)
if[5]($>2){"true<br />"}
# while
a[1]($<10){"@ is smaller<br />",$}{a[$+1]}
# range, substring
range[-4]
string[longstring|-4]
{"this is a short@",string}
{"<br />"}
# multi dimensional
array1[5,6,7,8]
array2[4,5,9,3]
combined[first:array1,second:array1]
returnval[combined.first]
{"@",returnval.0}
{"<br />"}
# inlet
postarray[<post>.key]
somegetvalue[<get>.key]
(getarray){"@<br />",somegetvalue}
# string explicit
somestr["range",test]
print{somestr.0}
notprint{somestr.1}
# Merge Array
array1[1,2]
array2[3,4]
merger[array1&array2]
# function declare
($){"echo: @",$}