-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.tlang
64 lines (44 loc) · 1.11 KB
/
demo.tlang
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
# Anything that doesn't get recognised as a special character will be classed as a comment
@s func [1]
$var_local <- int = 5
$var_local <- int = 6
r($var_local + $var_local - $1)
(always returns in string, if numeric will return numeric)
@e func
@s square_root [1]
i($1 > 0)s
r($1**0.5)
# ie
ei($1 == 0)s
r(0)
eie
es
r("Number smaller than one is not permitted")
ee
@e square_root
@s factorial [1]
$temp = 1
wf($var = 1, $var < $1)s
$temp = $temp * $var
wf($var++)e # could also be $var += 5
r($temp)
@e factorial
@s add [2]
r($1 + $2)
@e add
# start
@s main
p($bruh) # <- not permitted
dfjghdjfhgdkijfhgd
$string_var <- string = "Hello world \$"
$int_var <- integer = 5
$float_var <- float = 5.5
$bool_var <- boolean = False
p($string_var, $bool_var)
p("$int_var + $float_var =", $int_var + $float_var)
p("Your first two flags are: ", $1, $2)
p("All of your flags are:", $0)
p("testing whitespace character against variable, \$hello")
p(@func[$int_var])
@e main
# end