blob: eb9f990fbb51e18d6901c48e34e208aae5d1f445 (
plain) (
blame)
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
|
/* HELLO! Welcome to the unnamed language */
extern printf = (*i8, varargs) => void;
extern exit = (i64) => void;
let strcmp = (stra: *i8, strb: *i8) => bool {
let i = 0;
while i < 10 {
printf("I: %d\n", i); /* CONTINUE */
i = i + 1;
};
return true;
};
let isdigit = (c: i8) => bool {
if c >= '0' {
if c <= '9' {
return true;
};
};
return false;
};
let isalpha = (c: i8) => bool {
if c >= 'a' {
if c <= 'z' {
return true;
};
};
if c >= 'A' {
if c <= 'Z' {
return true;
};
};
return false;
};
let isalphanum = (c: i8) => bool {
if isalpha(c) {
return true;
};
if isdigit(c) {
return true;
};
return false;
};
let iswhitespace = (c: i8) => bool {
if c == ' ' {
return true;
};
if c >= '\t' {
if c <= '\r' {
return true;
};
};
return false;
};
let assert = (cond: bool) => void {
if !cond {
printf("ASSERTION FAILED\n");
exit(1);
};
return;
};
let main = (argc: i64, argv: *i64) => i64 {
printf("%d\n", argc);
isdigit('a');
strcmp("a", "b");
return 2;
};
/*
Expected stdout:
1
Expected return: 2
*/
|