p-lang 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,72 +0,0 @@
1
- [[:+, [:literal, :integer, 1], [:literal, :integer, 2]]]
2
- [[:+,[:literal, :integer, 1],[:+, [:literal, :integer, 2], [:literal, :integer, 3]]]]
3
- [[:*, [:literal, :integer, 4], [:literal, :integer, 5]]]
4
- [[:/, [:literal, :integer, 4], [:literal, :integer, 2]]]
5
- [[:%, [:literal, :integer, 5], [:literal, :integer, 3]]]
6
- [[:+,[:literal, :integer, 1],[:*,[:literal, :integer, 2],[:/, [:literal, :integer, 3], [:literal, :integer, 5]]]]]
7
- [[:*,[:+,[:literal, :integer, 1],[:literal, :integer, 6]],[:literal, :integer, 5]]]
8
- [[:+,[:literal, :integer, 1],[:/,[:*, [:literal, :integer, 2], [:literal, :integer, 3]],[:-, [:literal, :integer, 5], [:literal, :integer, 1]]]]]
9
- [[:+, [:literal, :decimal, 1.3],[:*,[:literal, :integer, 5],[:+, [:literal, :integer, 1], [:literal, :decimal, 1.568]]]]]
10
- [[:id, :xyz]]
11
- [[:>, [:literal, :integer, 1], [:literal, :integer, 2]]]
12
- [[:>=, [:id, :x], [:literal, :integer, 1]]]
13
- [[:<=, [:literal, :integer, 2], [:id, :b]]]
14
- [[:==, [:literal, :integer, 4], [:literal, :integer, 1]]]
15
- [[:<, [:literal, :integer, 2], [:id, :x]]]
16
- [[:object, :obj, []]]
17
- [[:object, :obj, [[:literal, :integer, 1], [:literal, :integer, 2], [:literal, :integer, 3]]]]
18
- [[:object,:obj,[[:+, [:literal, :integer, 1], [:literal, :integer, 2]], [:id, :x]]]]
19
- [[:object, :obj, [[:literal, :integer, 1], [:literal, :integer, 2]]]]
20
- [[:object, :obj, [[:id, :x], [:literal, :integer, 2], [:object, :other, []]]]]
21
- [[:object, :obj, [[:literal, :integer, 1]]]]
22
- [[:literal, :string, "teste"]]
23
- [[:literal, :char, "a"]]
24
- [[:if,[:>, [:id, :x], [:literal, :integer, 1]],[:literal, :string, "verdadeiro"],[:literal, :string, "falso"]]]
25
- [[:begin,[[:+,[:literal, :integer, 1],[:+, [:literal, :integer, 2], [:literal, :integer, 3]]],[:literal, :string, "oi"],[:<, [:literal, :integer, 2], [:literal, :integer, 3]],[:literal, :char, "a"]]]]
26
- [[:-,[:call, [:id, :sin], [[:*, [:literal, :integer, 2], [:id, :pi]]]],[:call, [:id, :cos], [[:*, [:literal, :integer, 2], [:id, :pi]]]]]]
27
- [[:call, [:id, :f], []]]
28
- [[:let, [:id, :x], [:literal, :integer, 1]]]
29
- [[:let,[:id, :x],[:+,[:literal, :integer, 1],[:+,[:literal, :integer, 2],[:+, [:literal, :integer, 3], [:literal, :integer, 4]]]]]]
30
- [[:let,[:id, :y],[:+,[:literal, :integer, 1],[:*, [:literal, :integer, 2], [:/, [:id, :x], [:literal, :integer, 2]]]]]]
31
- [[:let, [:id, :str], [:literal, :string, "string"]]]
32
- [[:let,[:id, :p1],[:call, [:id, :point], [[:literal, :integer, 1], [:literal, :integer, 2]]]]]
33
- [[:let,[:object, :obj, [[:id, :x]]],[:object, :obj, [[:literal, :integer, 1]]]]]
34
- [[:let, [:object, :obj, [[:id, :x], [:id, :t]]], [:id, :obj]]]
35
- [[:lambda, [[:id, :x]], [:id, :x], [],nil]]
36
- [[:lambda, [[:id, :x],[:id, :y]], [:+, [:id, :x], [:id, :y]], [],nil]]
37
- [[:lambda,[[:literal, :integer, 1],[:literal, :integer, 2],[:id, :x],[:object, :obj, [[:id, :x], [:id, :y]]]],[:literal, :integer, 1],[],nil]]
38
- [[:lambda,[[:id, :x]],[:id, :y],[[:let,[:id, :y],[:lambda, [[:id, :x]], [:+, [:id, :x], [:literal, :integer, 6]], [],nil]]],nil]]
39
- [[:lambda,[[:id, :x]],[:id, :y],[[:let,[:id, :y],[:lambda, [[:id, :x]], [:+, [:id, :x], [:literal, :integer, 6]], [], nil]],[:let,[:id, :z],[:lambda,[[:id, :x]],[:-, [:id, :x], [:literal, :integer, 6]],[],nil]],[:let, [:id, :k], [:literal, :integer, 1]]],nil]]
40
- [[:let, [:id, :x], [:lambda, [], [:literal, :integer, 1], [],nil]]]
41
- [[:let,[:id, :fibonacci],[:lambda,[[:literal, :integer, 1]],[:literal, :integer, 1],[],[:lambda,[[:literal, :integer, 2]],[:literal, :integer, 1],[],[:lambda,[[:id, :n]],[:+,[:call, [:id, :fibonacci], [[:-, [:id, :n], [:literal, :integer, 1]]]],[:call, [:id, :fibonacci], [[:-, [:id, :n], [:literal, :integer, 2]]]]],[],nil]]]]]
42
- [[:let,[:id, :str_list],[:object,:list,[[:literal, :char, "s"],[:object,:list,[[:literal, :char, "t"],[:object,:list,[[:literal, :char, "r"],[:object,:list,[[:literal, :char, "i"],[:object,:list,[[:literal, :char, "n"],[:object,:list,[[:literal, :char, "g"], [:object, :list, []]]]]]]]]]]]]]]]
43
- [[:let,[:id, :point],[:lambda,[[:id, :x], [:id, :y]],[:object, :point, [[:id, :x], [:id, :y]]],[],nil]]]
44
- [[:let,[:id, :point_x],[:lambda, [[:object, :point, [[:id, :x], [:id, :y]]]], [:id, :x], [],nil]]]
45
- [[:let,[:id, :point_y],[:lambda, [[:object, :point, [[:id, :x], [:id, :y]]]], [:id, :y], [],nil]]]
46
- [[:let,[:id, :point_sum],[:lambda,[[:object, :point, [[:id, :x1], [:id, :y1]]],[:object, :point, [[:id, :x2], [:id, :y2]]]],[:object,:point,[[:+, [:id, :x1], [:id, :x2]], [:+, [:id, :y1], [:id, :y2]]]],[],nil]]]
47
- [[:let,[:id, :sum],[:lambda, [[:id, :a], [:id, :b]], [:+, [:id, :a], [:id, :b]], [], nil]]]
48
- [[:let,[:id, :f],[:lambda,[[:id, :x]],[:begin,[[:let, [:id, :algo], [:id, :x]],[:*, [:id, :algo], [:id, :algo]],[:id, :algo]]],[], nil]]]
49
- [[:let,[:id, :f],[:lambda,[[:id, :x]],[:+, [:call, [:id, :f], [[:id, :x]]], [:call, [:id, :g], [[:id, :x]]]],[[:let,[:id, :f],[:lambda, [[:id, :x]], [:*, [:id, :x], [:id, :x]], [], nil]],[:let,[:id, :g],[:lambda,[[:id, :x]],[:/, [:id, :x], [:literal, :integer, 2]],[],nil]]],nil]]]
50
- [[:let,[:id, :f],[:lambda,[[:id, :x]],[:id, :y],[[:let, [:id, :y], [:*, [:literal, :integer, 2], [:id, :x]]]], nil]]]
51
- [[:object_call, [:id, :p], [:id, :x]]]
52
- [[:call,[:object_call, [:id, :p], [:id, :x]],[[:id, :p], [:literal, :integer, 1]]]]
53
- [[:call, [:object_call, [:id, :p], [:id, :x]], [[:id, :p]]]]
54
- [[:call,[:object_call, [:call, [:id, :f], [[:literal, :integer, 1]]], [:id, :algo]],[[:call, [:id, :f], [[:literal, :integer, 1]]], [:literal, :integer, 1]]]]
55
- [[:call, [:object_call, [:id, :x], [:id, :algo]], [[:id, :x]]]]
56
- [[:call,[:object_call, [:literal, :integer, 10], [:id, :algo]],[[:literal, :integer, 10],[:literal, :integer, 1],[:literal, :integer, 2],[:literal, :integer, 3]]]]
57
- [[:call,[:object_call,[:object, :algo, [[:literal, :integer, 1], [:literal, :integer, 2]]],[:id, :algo]],[[:object, :algo, [[:literal, :integer, 1], [:literal, :integer, 2]]]]]]
58
- [[:call,[:object_call, [:object, :algo, [[:id, :x], [:id, :y]]], [:id, :x]],[[:object, :algo, [[:id, :x], [:id, :y]]]]]]
59
- [[:object_let,[:object, :point, [[:id, :x], [:id, :y]]],[:id, :x],[:lambda, [[:id, :x]], [:id, :x], [], nil]]]
60
- [[:object_let,[:object, :aaaa, [[:id, :x], [:id, :y]]],[:id, :a],[:lambda, [], [:id, :x], [[:let, [:id, :x], [:literal, :integer, 1]]], nil]]]
61
- [[:object_let,[:object, :aaaa, [[:id, :x], [:id, :y]]],[:id, :algo],[:lambda,[[:id, :x]],[:id, :y],[[:let,[:id, :y],[:lambda, [[:id, :x]], [:+, [:id, :x], [:literal, :integer, 6]], [], nil]]], nil]]]
62
- [[:object_let,[:object, :algo, [[:id, :x], [:id, :y]]],[:id, :algo],[:lambda, [[:id, :x]], [:id, :x], [], nil]]]
63
- [[:object_let, [:object, :algo, []], [:id, :algo], [:literal, :integer, 1]]]
64
- [[:literal, :boolean, :true]]
65
- [[:literal, :boolean, :false]]
66
- [[:let, [:id, :x], [:literal, :boolean, :true]]]
67
- [[:if,[:literal, :boolean, :true],[:literal, :string, "sim"],[:literal, :string, "nao"]]]
68
- [[:and, [:id, :x], [:id, :y]]]
69
- [[:if,[:and, [:literal, :boolean, :true], [:literal, :boolean, :false]],[:literal, :integer, 1],[:literal, :integer, 2]]]
70
- [[:if,[:or, [:and, [:id, :x], [:id, :y]], [:id, :z]],[:literal, :integer, 1],[:literal, :integer, 2]]]
71
- [[:not, [:literal, :boolean, :true]]]
72
- [[:let, [:id, :x], [:or, [:and, [:id, :x], [:id, :y]], [:not, [:id, :k]]]]]
@@ -1,64 +0,0 @@
1
- 1
2
- 1+2
3
- 4-7
4
- 3*2
5
- 6/2
6
- 6.0-0.5
7
- 5%2
8
- 1>2
9
- 1>=1
10
- 3<1
11
- 7<=0
12
- (2>0) and (3<1)
13
- true or false
14
- x=1 x+2
15
- x=1 y=2 x+y
16
- soma = [a,b| a+b] soma(3,4)
17
- soma = [a,b| a+b] soma(3,4)+10
18
- soma = [a,b| sum] : (sum = a+b) soma(10,5)
19
- fib = [1|1], [2|1], [n| fib(n-1)+fib(n-2)] fib(8)
20
- x=1 y=2 f=[x| x+y] f(10)
21
- if (true, 1, 2)
22
- if (false, 1, 2)
23
- begin(1,2,3,4)
24
- {obj: x, y} = {obj: 1, 2} x+y
25
- {obj: 5, 10, z} = {obj: 5, 10, 15} z
26
- [{obj: 10, x}| x]({obj: 10, -5})
27
- [{obj: {algo}, x}| x]({obj: {algo}, 13})
28
- [{obj: {algo: 10}, x}| x]({obj: {algo: 10}, 1})
29
- [{obj: {algo: x}, y}| x+y]({obj: {algo: 1}, 2})
30
- [{obj: {algo: x}, y}, 1, z, {ok}| x+y+z]({obj: {algo: 1}, 2}, 1, 10, {ok})
31
- [{ok}| 10]({ok})
32
- {obj: 1, x} -> f = [x] {obj: 2, x} -> f = [x+1] a = {obj: 2, 20} a -> f()
33
- {obj: 1, x} -> f = [x] {obj: 2, x} -> f = [x+1] a = {obj: 1, 20} a -> f()
34
- {obj: x} -> f = [x-1] {obj: 1} -> f()
35
- {obj: 1, 2, 3, x} -> f = [1+2+3+x] {obj: 1, 2, 3, 10}->f()
36
- f = [_,x,_| x*2] f(1,2,3)
37
- f = [{obj: {xxx: _}, x}, y| x+y] f({obj: {xxx: 1}, 2}, 3)
38
- list_sum = [{list: head, tail}| head + list_sum(tail)], [{list}| 0] list_sum({list: 1, {list: 2, {list}}})
39
- f = [x| x(10)] g = [x| x+1] f(g)
40
- "aaaaa"->append("bbbbb")
41
- "aaaaa"->equal("bbbbb")
42
- "aaaaa"->equal("aaaaa")
43
- "abcde"->at(2)
44
- "abcde"->capitalize()
45
- "abcde"->center(10)
46
- "aBcDe"->downcase()
47
- "aBcDe"->is_empty()
48
- "0xB"->hex()
49
- "abcde"->index("c")
50
- "abcde"->insert(3, "X")
51
- "abcde"->length()
52
- "10"->oct()
53
- "abcde"->reverse()
54
- "10"->to_integer()
55
- "10.11"->to_decimal()
56
- "aBcDe"->upcase()
57
- (-1)->abs()
58
- (-1)->next()
59
- (-1)->to_decimal()
60
- (-1)->to_string()
61
- (-1.1)->abs()
62
- (-1.1)->ceil()
63
- (-1.1)->floor()
64
- (-1.1)->to_string()
@@ -1,64 +0,0 @@
1
- 1
2
- 3
3
- -3
4
- 6
5
- 3
6
- 5.5
7
- 1
8
- false
9
- true
10
- false
11
- false
12
- false
13
- true
14
- 3
15
- 3
16
- 7
17
- 17
18
- 15
19
- 21
20
- 12
21
- 1
22
- 2
23
- 4
24
- 3
25
- 15
26
- -5
27
- 13
28
- 1
29
- 3
30
- 13
31
- 10
32
- 21
33
- 20
34
- 0
35
- 16
36
- 4
37
- 5
38
- 3
39
- 11
40
- "aaaaabbbbb"
41
- false
42
- true
43
- "c"
44
- "Abcde"
45
- " abcde "
46
- "abcde"
47
- false
48
- 11
49
- 2
50
- "abcXde"
51
- 5
52
- 8
53
- "edcba"
54
- 10
55
- 10.11
56
- "ABCDE"
57
- 1
58
- 0
59
- -1.0
60
- "-1"
61
- 1.1
62
- -1
63
- -2
64
- "-1.1"