diff options
| author | Baitinq <[email protected]> | 2025-06-11 00:16:17 +0200 |
|---|---|---|
| committer | Baitinq <[email protected]> | 2025-06-11 00:16:17 +0200 |
| commit | fa92a157746ae17f295d31b7a047dfeb99624a13 (patch) | |
| tree | 71e469e67a70df15542d873ebe223654def6111b | |
| parent | stdlib: Remove println (diff) | |
| download | interpreter-fa92a157746ae17f295d31b7a047dfeb99624a13.tar.gz interpreter-fa92a157746ae17f295d31b7a047dfeb99624a13.tar.bz2 interpreter-fa92a157746ae17f295d31b7a047dfeb99624a13.zip | |
| -rw-r--r-- | README.md | 7 | ||||
| -rw-r--r-- | examples/-1.pry (renamed from examples/-1.src) | 0 | ||||
| -rw-r--r-- | examples/0.pry (renamed from examples/0.src) | 2 | ||||
| -rw-r--r-- | examples/1.5.pry (renamed from examples/1.5.src) | 2 | ||||
| -rw-r--r-- | examples/1.pry (renamed from examples/1.src) | 2 | ||||
| -rw-r--r-- | examples/10.pry (renamed from examples/10.src) | 2 | ||||
| -rw-r--r-- | examples/11.pry (renamed from examples/11.src) | 2 | ||||
| -rw-r--r-- | examples/12.pry (renamed from examples/12.src) | 2 | ||||
| -rw-r--r-- | examples/13.pry (renamed from examples/13.src) | 2 | ||||
| -rw-r--r-- | examples/14.pry (renamed from examples/14.src) | 0 | ||||
| -rw-r--r-- | examples/15.pry (renamed from examples/15.src) | 0 | ||||
| -rw-r--r-- | examples/16.pry (renamed from examples/16.src) | 0 | ||||
| -rw-r--r-- | examples/17.pry (renamed from examples/17.src) | 2 | ||||
| -rw-r--r-- | examples/18.pry (renamed from examples/18.src) | 2 | ||||
| -rw-r--r-- | examples/19.pry (renamed from examples/19.src) | 0 | ||||
| -rw-r--r-- | examples/2.pry (renamed from examples/2.src) | 2 | ||||
| -rw-r--r-- | examples/20.pry (renamed from examples/20.src) | 2 | ||||
| -rw-r--r-- | examples/21.pry (renamed from examples/21.src) | 2 | ||||
| -rw-r--r-- | examples/22.pry (renamed from examples/22.src) | 2 | ||||
| -rw-r--r-- | examples/23.pry (renamed from examples/23.src) | 2 | ||||
| -rw-r--r-- | examples/24.pry (renamed from examples/24.src) | 2 | ||||
| -rw-r--r-- | examples/3.pry (renamed from examples/3.src) | 2 | ||||
| -rw-r--r-- | examples/4.pry (renamed from examples/4.src) | 2 | ||||
| -rw-r--r-- | examples/5.pry (renamed from examples/5.src) | 2 | ||||
| -rw-r--r-- | examples/6.5.pry (renamed from examples/6.5.src) | 2 | ||||
| -rw-r--r-- | examples/6.pry (renamed from examples/6.src) | 2 | ||||
| -rw-r--r-- | examples/7.pry (renamed from examples/7.src) | 2 | ||||
| -rw-r--r-- | examples/8.pry (renamed from examples/8.src) | 2 | ||||
| -rw-r--r-- | examples/9.pry (renamed from examples/9.src) | 2 | ||||
| -rw-r--r-- | src/bootstrap/codegen.pry (renamed from src/bootstrap/codegen.src) | 2 | ||||
| -rw-r--r-- | src/bootstrap/llvm.pry (renamed from src/bootstrap/llvm.src) | 0 | ||||
| -rw-r--r-- | src/bootstrap/main.pry (renamed from src/bootstrap/main.src) | 10 | ||||
| -rw-r--r-- | src/bootstrap/parser.pry (renamed from src/bootstrap/parser.src) | 0 | ||||
| -rw-r--r-- | src/bootstrap/tokenizer.pry (renamed from src/bootstrap/tokenizer.src) | 4 | ||||
| -rw-r--r-- | std/mem.pry (renamed from std/mem.src) | 2 | ||||
| -rw-r--r-- | std/stdlib.pry (renamed from std/stdlib.src) | 0 |
36 files changed, 36 insertions, 35 deletions
diff --git a/README.md b/README.md index a6e18d3..3e5ef9a 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# Programming Language +# Pry Programming Language -Simple statically typed and compiled programming language implemented in Zig, with support for variables, control flow, functions, and code generation using LLVM. +Pry is a simple, elegant, 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 + zig build run -- examples/8.pry ``` 3. Link the generated object file to create an executable: ``` @@ -25,6 +25,7 @@ Simple statically typed and compiled programming language implemented in Zig, wi - **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. +- **Import System**: Allows importing libraries and other Pry files. ## Example Program diff --git a/examples/-1.src b/examples/-1.pry index 4b77e10..4b77e10 100644 --- a/examples/-1.src +++ b/examples/-1.pry diff --git a/examples/0.src b/examples/0.pry index 56b540e..90a6861 100644 --- a/examples/0.src +++ b/examples/0.pry @@ -1,6 +1,6 @@ /* HELLO! Welcome to the unnamed language */ -import "!stdlib.src"; +import "!stdlib.pry"; let main = (argc: i64, argv: *i64) => i64 { printf("%d\n", argc); diff --git a/examples/1.5.src b/examples/1.5.pry index 6997d74..375e2d5 100644 --- a/examples/1.5.src +++ b/examples/1.5.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let x = () => i64 { printf("%d\n", 22); diff --git a/examples/1.src b/examples/1.pry index 6fef25a..c497dc4 100644 --- a/examples/1.src +++ b/examples/1.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let main = () => i64 { let s = "hello"; diff --git a/examples/10.src b/examples/10.pry index d8dde60..a11608d 100644 --- a/examples/10.src +++ b/examples/10.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let main = () => i64 { let counter = 0; diff --git a/examples/11.src b/examples/11.pry index 5c2acad..2349f10 100644 --- a/examples/11.src +++ b/examples/11.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let id = (a: i64) => i64 { printf("%d\n", a); diff --git a/examples/12.src b/examples/12.pry index 1193e4c..34519e6 100644 --- a/examples/12.src +++ b/examples/12.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let main = () => i64 { let factorial = (n: i64) => i64 { diff --git a/examples/13.src b/examples/13.pry index 9de55ac..839caef 100644 --- a/examples/13.src +++ b/examples/13.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let main = () => i64 { /* Iterative Fibonacci using while loop. */ diff --git a/examples/14.src b/examples/14.pry index 9792530..9792530 100644 --- a/examples/14.src +++ b/examples/14.pry diff --git a/examples/15.src b/examples/15.pry index a5aac79..a5aac79 100644 --- a/examples/15.src +++ b/examples/15.pry diff --git a/examples/16.src b/examples/16.pry index 3fb29f7..3fb29f7 100644 --- a/examples/16.src +++ b/examples/16.pry diff --git a/examples/17.src b/examples/17.pry index 93a313f..c320044 100644 --- a/examples/17.src +++ b/examples/17.pry @@ -1,7 +1,7 @@ extern malloc = (i64) => *i64; extern free = (*i64) => void; -import "!stdlib.src"; +import "!stdlib.pry"; let main = () => i64 { let x = malloc(8); diff --git a/examples/18.src b/examples/18.pry index 741a460..32b2d1a 100644 --- a/examples/18.src +++ b/examples/18.pry @@ -1,7 +1,7 @@ extern malloc = (i64) => *void; extern free = (*void) => void; -import "!stdlib.src"; +import "!stdlib.pry"; let main = () => i64 { let x = cast(*i8, malloc(24)); diff --git a/examples/19.src b/examples/19.pry index 2ae1973..2ae1973 100644 --- a/examples/19.src +++ b/examples/19.pry diff --git a/examples/2.src b/examples/2.pry index d6a81b8..2367212 100644 --- a/examples/2.src +++ b/examples/2.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let main = () => i64 { let test = 1922; diff --git a/examples/20.src b/examples/20.pry index 6acabc8..0cae122 100644 --- a/examples/20.src +++ b/examples/20.pry @@ -2,7 +2,7 @@ extern malloc = (i64) => *void; extern free = (*void) => void; -import "!stdlib.src"; +import "!stdlib.pry"; let init_array = (n: i64, arr: *i64) => i64 { let i = 0; diff --git a/examples/21.src b/examples/21.pry index 804b242..fb30960 100644 --- a/examples/21.src +++ b/examples/21.pry @@ -2,7 +2,7 @@ extern rand = () => i64; extern malloc = (i64) => *void; extern free = (*void) => void; -import "!stdlib.src"; +import "!stdlib.pry"; let init_array = (n: i64, arr: *i64) => void { let i = 0; diff --git a/examples/22.src b/examples/22.pry index cc367bf..b57d7c9 100644 --- a/examples/22.src +++ b/examples/22.pry @@ -1,6 +1,6 @@ extern malloc = (i64) => *void; -import "!stdlib.src"; +import "!stdlib.pry"; /* declare new struct type */ let test = struct { diff --git a/examples/23.src b/examples/23.pry index 31277c9..65b3279 100644 --- a/examples/23.src +++ b/examples/23.pry @@ -1,6 +1,6 @@ extern malloc = (i64) => *void; -import "!stdlib.src"; +import "!stdlib.pry"; let test = struct { x: i64, diff --git a/examples/24.src b/examples/24.pry index 7349906..f30a7fc 100644 --- a/examples/24.src +++ b/examples/24.pry @@ -1,6 +1,6 @@ extern malloc = (i64) => *void; -import "!stdlib.src"; +import "!stdlib.pry"; let test = struct { x: i64, diff --git a/examples/3.src b/examples/3.pry index f10f05c..c7b2347 100644 --- a/examples/3.src +++ b/examples/3.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let main = () => i64 { let seventeen = 10 + 2 + 4; diff --git a/examples/4.src b/examples/4.pry index 7787593..b8c48d2 100644 --- a/examples/4.src +++ b/examples/4.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let main = () => i64 { let print_one = () => i64 { diff --git a/examples/5.src b/examples/5.pry index f6b2e62..f12fbae 100644 --- a/examples/5.src +++ b/examples/5.pry @@ -1,6 +1,6 @@ /* As you see, the language supports variable scopes */ -import "!stdlib.src"; +import "!stdlib.pry"; let x = 18; diff --git a/examples/6.5.src b/examples/6.5.pry index f7d6229..057181f 100644 --- a/examples/6.5.src +++ b/examples/6.5.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let main = () => i64 { let x = !(1 == 1); diff --git a/examples/6.src b/examples/6.pry index 3793f24..008ecd9 100644 --- a/examples/6.src +++ b/examples/6.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let print_input = (input_a: i64, input_b: i64) => i64 { printf("%d\n", input_a); diff --git a/examples/7.src b/examples/7.pry index a94891d..5867c4e 100644 --- a/examples/7.src +++ b/examples/7.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let ten = () => i64 { return () => i64 { diff --git a/examples/8.src b/examples/8.pry index 671640b..51953d0 100644 --- a/examples/8.src +++ b/examples/8.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let main = () => i64 { let fib = (n: i64) => i64 { diff --git a/examples/9.src b/examples/9.pry index ae586c2..bbe4b50 100644 --- a/examples/9.src +++ b/examples/9.pry @@ -1,4 +1,4 @@ -import "!stdlib.src"; +import "!stdlib.pry"; let print_boolean = (b: bool) => i64 { printf("%d\n", b); diff --git a/src/bootstrap/codegen.src b/src/bootstrap/codegen.pry index 7059508..7293c09 100644 --- a/src/bootstrap/codegen.src +++ b/src/bootstrap/codegen.pry @@ -1,4 +1,4 @@ -import "llvm.src"; +import "llvm.pry"; let codegen = struct { llvm_module: LLVMModuleRef, diff --git a/src/bootstrap/llvm.src b/src/bootstrap/llvm.pry index 8cd600f..8cd600f 100644 --- a/src/bootstrap/llvm.src +++ b/src/bootstrap/llvm.pry diff --git a/src/bootstrap/main.src b/src/bootstrap/main.pry index 571cc03..29e41ff 100644 --- a/src/bootstrap/main.src +++ b/src/bootstrap/main.pry @@ -6,17 +6,17 @@ extern ftell = (*i8) => i64; extern fread = (*i8, i64, i64, *i8) => i64; extern fclose = (*i8) => *i8; -import "!stdlib.src"; -import "!mem.src"; +import "!stdlib.pry"; +import "!mem.pry"; let slice = struct { data: *void, data_len: i64, }; -import "tokenizer.src"; -import "parser.src"; -import "codegen.src"; +import "tokenizer.pry"; +import "parser.pry"; +import "codegen.pry"; let read_file = (filename: *i8, alloc: *arena) => slice { let file = fopen(filename, "r"); diff --git a/src/bootstrap/parser.src b/src/bootstrap/parser.pry index daac296..daac296 100644 --- a/src/bootstrap/parser.src +++ b/src/bootstrap/parser.pry diff --git a/src/bootstrap/tokenizer.src b/src/bootstrap/tokenizer.pry index 8d7f997..a2cafb4 100644 --- a/src/bootstrap/tokenizer.src +++ b/src/bootstrap/tokenizer.pry @@ -3,8 +3,8 @@ extern memcpy = (*void, *void, i64) => void; extern sprintf = (*i8, *i8, varargs) => void; extern atoi = (*i8) => i64; -import "!stdlib.src"; -import "!mem.src"; +import "!stdlib.pry"; +import "!mem.pry"; /* Keywords */ let TOKEN_IMPORT = 1; diff --git a/std/mem.src b/std/mem.pry index 3bb1a0a..75f3d1d 100644 --- a/std/mem.src +++ b/std/mem.pry @@ -2,7 +2,7 @@ extern calloc = (i64, i64) => *void; extern realloc = (*void, i64) => *void; extern free = (*void) => void; -import "!stdlib.src"; +import "!stdlib.pry"; let arena = struct { buf: *void, diff --git a/std/stdlib.src b/std/stdlib.pry index aecd4df..aecd4df 100644 --- a/std/stdlib.src +++ b/std/stdlib.pry |