about summary refs log tree commit diff
path: root/README.md
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-03-12 00:47:31 +0100
committerBaitinq <[email protected]>2025-03-12 00:47:43 +0100
commitda0788140e7afbc9b0bcbb937a29e2b08de08ec7 (patch)
treeef6435c7c91f40926f01f5faa9b4dbc2946a5caf /README.md
parentCodegen: add bundled llvm (diff)
parentCodegen: Fix bug with functions without name (diff)
downloadinterpreter-da0788140e7afbc9b0bcbb937a29e2b08de08ec7.tar.gz
interpreter-da0788140e7afbc9b0bcbb937a29e2b08de08ec7.tar.bz2
interpreter-da0788140e7afbc9b0bcbb937a29e2b08de08ec7.zip
Merge branch 'master' into native-llvm
Diffstat (limited to 'README.md')
-rw-r--r--README.md50
1 files changed, 50 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a6e18d3
--- /dev/null
+++ b/README.md
@@ -0,0 +1,50 @@
+# Programming Language
+
+Simple statically typed and compiled programming language implemented in Zig, with support for variables, control flow, functions, and code generation using LLVM.
+
+## Building and Running
+
+1. Ensure you have Zig and LLVM installed on your system.
+2. Run the compiler on an example file:
+   ```
+   zig build run -- examples/8.src compile
+   ```
+3. Link the generated object file to create an executable:
+   ```
+   cc output.o
+   ```
+4. Run the executable:
+   ```
+   ./a.out
+   ```
+
+## Language Features
+
+- **Variables and Declarations**: Uses `let` for variable declaration.
+- **Control Flow**: Supports `if` and `while` statements.
+- **Functions**: Supports function declarations with parameters and return types.
+- **Expressions**: Includes additive, multiplicative, equality, and unary expressions.
+- **Code Generation with LLVM**: Translates AST to LLVM IR and generates object files for native execution.
+
+## Example Program
+
+```js
+let main = () => i64 {
+	let fib = (n: i64) => i64 {
+		if n == 0 {
+			return 0;
+		};
+		if n == 1 {
+			return 1;
+		};
+		return fib(n-2) + fib(n-1);
+	};
+
+	let result = fib(30);
+	print(result);
+	return result;
+};
+```
+```
+Output: 832040
+```