]> ruin.nu Git - proglang.git/blob - documentation
initial commit
[proglang.git] / documentation
1 ####### DOCUMENTATIATOIAITAT ION ########
2
3
4
5
6 a simple c-like language with support for if/else-statements, while-loops and the standard arithmetic (+, -, /, *) and comparison expressions (<, >, <=, >=, ==, !=). also, increase/decrease expressions (++, --) are supported.
7
8 data types:
9 integers and booleans.
10
11 comments:
12 // and /* */ comments are allowed.
13
14
15
16
17
18
19
20
21
22
23
24
25
26 examples:
27
28 fib
29 ---
30 int n1 = 0;
31 int n2 = 1;
32 int n = readInt;
33
34 while(n-- > 0){
35   int temp = n1+n2;
36   n1 = n2;
37   n2 = temp;
38 }
39 print n2;
40
41
42 tests while, decr and assignment.
43
44
45
46 if
47 --
48 if (readBool) {
49   if (readInt < 0)
50     print true;
51   else
52     print false;
53 }
54
55
56 tests if and if/else.
57
58
59
60 sum
61 ---
62 int n;
63 int sum = 0;
64 while ((n = readInt) != -1) sum = sum + n;
65 print sum;
66
67
68
69
70 var
71 ---
72 int a = 3;
73 int b = a - 5;
74 int c = a + b*7;
75 bool d = a == b;
76
77 tests simple variable operations.