about summary refs log tree commit diff
path: root/examples/0.pry
diff options
context:
space:
mode:
Diffstat (limited to 'examples/0.pry')
-rw-r--r--examples/0.pry72
1 files changed, 72 insertions, 0 deletions
diff --git a/examples/0.pry b/examples/0.pry
index d0054f2..eb9f990 100644
--- a/examples/0.pry
+++ b/examples/0.pry
@@ -1,7 +1,79 @@
 /* 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;
 };