Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
cfb5055
Update README.md
DanexCodr Dec 15, 2025
6622212
Update README.md
DanexCodr Dec 15, 2025
220b5ac
Fix syntax in InteractiveDemo section of README
DanexCodr Dec 15, 2025
96bbeac
Delete src/main/java/cod/Constants.java
DanexCodr Dec 15, 2025
741b68b
Delete src/main/java/cod/runner/CompilationEngine.java
DanexCodr Dec 15, 2025
a52436f
Delete src/main/java/cod/compiler/natives directory
DanexCodr Dec 15, 2025
d864dfb
Delete src/main/java/cod/compiler/BytecodeCompiler.java
DanexCodr Dec 15, 2025
0333094
Delete src/main/java/cod/compiler/RegisterManager.java
DanexCodr Dec 15, 2025
463e99a
Delete src/main/java/cod/compiler/BytecodeInstruction.java
DanexCodr Dec 15, 2025
a1b6ed0
Delete src/main/java/cod/compiler/BytecodeProgram.java
DanexCodr Dec 15, 2025
69f8f1f
Delete src/main/java/cod/compiler/MTOTRegistry.java
DanexCodr Dec 15, 2025
7a01e40
Delete src/main/java/cod/ast/error directory
DanexCodr Dec 15, 2025
6c3497d
Delete src/main/java/cod/ast/NamingValidator.java
DanexCodr Dec 15, 2025
ffeaa6c
Delete src/main/java/cod/ast/ManualCoderiveParser.java
DanexCodr Dec 15, 2025
2a580d6
Delete src/main/java/cod/ast/ManualCoderiveLexer.java
DanexCodr Dec 15, 2025
bc5686e
Delete src/main/java/cod/ast/ImportResolver.java
DanexCodr Dec 15, 2025
e923887
Delete src/main/java/cod/ast/CoderiveParserVisitor.java
DanexCodr Dec 15, 2025
82ee37a
Delete src/main/java/cod/ast/CoderiveParserListener.java
DanexCodr Dec 15, 2025
c93cc37
Delete src/main/java/cod/ast/CoderiveParserBaseVisitor.java
DanexCodr Dec 15, 2025
2c0770d
Delete src/main/java/cod/ast/CoderiveParserBaseListener.java
DanexCodr Dec 15, 2025
6ef5608
Delete src/main/java/cod/ast/CoderiveParser.java
DanexCodr Dec 15, 2025
2e5f42f
Delete src/main/java/cod/ast/CoderiveLexer.java
DanexCodr Dec 15, 2025
b1e342a
Delete src/main/java/cod/ast/ASTBuilder.java
DanexCodr Dec 15, 2025
396b811
Add files via upload
DanexCodr Dec 15, 2025
b31a9d4
Add files via upload
DanexCodr Dec 15, 2025
e19141a
Add files via upload
DanexCodr Dec 15, 2025
6637c7f
Add files via upload
DanexCodr Dec 15, 2025
83f4ca4
Delete src/main/java/cod/ast/nodes/StatementNode.java
DanexCodr Dec 15, 2025
4fc4fb3
Delete src/main/java/cod/ast/nodes/IfNode.java
DanexCodr Dec 15, 2025
387441f
Delete src/main/java/cod/ast/nodes/GetNode.java
DanexCodr Dec 15, 2025
7012259
Add files via upload
DanexCodr Dec 15, 2025
adb3aa8
Add files via upload
DanexCodr Dec 15, 2025
175224a
Add files via upload
DanexCodr Dec 15, 2025
dc31ead
Add files via upload
DanexCodr Dec 15, 2025
8bec5ef
Delete src/main/java/cod/interpreter/ExpressionEvaluator.java
DanexCodr Dec 15, 2025
d34d3dc
Delete src/main/java/cod/interpreter/StatementEvaluator.java
DanexCodr Dec 15, 2025
4ef80b2
Add files via upload
DanexCodr Dec 15, 2025
f12d873
Create BaseParser.java
DanexCodr Dec 15, 2025
8ed5ffd
Add files via upload
DanexCodr Dec 15, 2025
0c260ad
Create MainLexer.java
DanexCodr Dec 15, 2025
3a8b7ef
Create Symbol.java
DanexCodr Dec 15, 2025
27bf5b8
Add files via upload
DanexCodr Dec 15, 2025
72721ce
Create ImportResolver.java
DanexCodr Dec 15, 2025
ae11c67
Add files via upload
DanexCodr Dec 15, 2025
ff970e8
Create LexError.java
DanexCodr Dec 15, 2025
655e930
Add files via upload
DanexCodr Dec 15, 2025
a136863
Delete src/main/cod/cod directory
DanexCodr Dec 15, 2025
ea3d00f
Add files via upload
DanexCodr Dec 15, 2025
57c562d
Create Sys.cod
DanexCodr Dec 15, 2025
3970570
Add files via upload
DanexCodr Dec 15, 2025
abf0e1a
Update quick-test.yml
DanexCodr Dec 15, 2025
48f43a1
Delete lib directory
DanexCodr Dec 15, 2025
f1f8a82
Update CHANGELOG.md
DanexCodr Dec 15, 2025
140039f
Update CHANGELOG.md
DanexCodr Dec 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/quick-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
find src/main/java -name "*.java" > sources.txt
mkdir -p target/classes
javac -d target/classes @sources.txt
# Test with first .cdrv file found
TEST_FILE=$(find src/main/cdrv -name "*.cdrv" -type f | head -1)
# Test with first .cod file found
TEST_FILE=$(find src/main/cod -name "*.cod" -type f | head -1)
if [ -n "$TEST_FILE" ]; then
java -cp target/classes cdrv.runner.CompilerRunner --bytecode "$TEST_FILE"
fi
java -cp target/classes cod.runner.CompilerRunner --bytecode "$TEST_FILE"
fi
27 changes: 26 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@

All notable changes to Coderive are documented in this file.

## [v0.3.0] - The Design Leap - December 15, 2025

### 🚨 Breaking Changes
- **Completely abandoned `~|` to instead use `::` return slot operator** - Embracing suffix-style design, fully abandoning the prefix-style.
- **Replaced stack-based multi-arch compiler** - Ensuring lesser bug to show. (Status: Ongoing, Currently not priority)
- **Almost all classes renamed updated, and repackaged** - Full refactoring of classes and their packages for more cleaner view.
- **Replaced `<type><ws><name>` to use `<name><colon><optional-ws><type>` instead for variable declaration.** - `name: type` for declaration, `name: type = value` for explicit declaration and assignment, `name := value` for inferred declaration and assignment,`name = value` for reassignment

### ✨ Major Features
- **Three World System**
- Added three distinct types of programs for Coderive: Script, Method-only, and Module.
- **From String to Text**
- Replaced the previous `string` keyword with `text`.
- **Natural Array**
- Added supports for range for arrays
- Lazy array generation
- Immutable by default but can be mutable (Note: "Use moderately")
- Supports text as natural array.
- **Added numeric shorthands**
- Added support for common numeric shorthands: K, M, B, T, Q, Qi, e
- Case for this feature will be case-sensitive.
- **Added parameter skipping and named arguments support**

> Check for other new minor features if you have free time...

## [v0.2.3] - The Great Logic Revolution - November 23, 2025

### 🚨 Breaking Changes
Expand Down Expand Up @@ -99,4 +124,4 @@ user == any[admin, moderator, owner]
### 🎉 Initial Launch
- Created first repository for Coderive programming language
- Initial commit with foundational codebase structure
- Project inception marking the start of Coderive language development
- Project inception marking the start of Coderive language development
60 changes: 11 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ Coderive replaces traditional boolean operators with expressive quantifiers:
```python
share Calculator {

~| int result, string operation # Return slot declarations
local calculate(int a, int b) {
local calculate(int a, int b)
:: result: int, operation: text
{
~> a + b, "addition" # Slot assignments
}
}
Expand All @@ -104,13 +105,14 @@ for i by *2 in 1 to 10 { # Complex step patterns
unit sample.program

get {
cod.Math
lang.Math
}

share InteractiveDemo {

~| int formula, string operation
local calculate(int a, int b, string op) {
local calculate(a: int, b: int, op: text)
:: formula: int, operation: text
{
if all[a >= 0, b >= 0] {
if op == any["+", "-", "*"] {
~> a + b, "valid operation"
Expand All @@ -121,21 +123,10 @@ share InteractiveDemo {
}
```

## 4. Performance Validation
## 4. Compiler

The system demonstrates efficient execution across both interpreter and native compilation targets.
Internal performance profiling shows that Coderive's quantifier operations approach the efficiency of
highly optimized data structures in established languages.

<div align="center">

|Feature|Status|Target|Details|
|-------|------|------|-------|
|Interpreter|✅ Working|JVM Bytecode|Full language support|
|Native Compilation|✅ Working|ARM64/x86_64|Advanced register allocation|
|Quantifier Performance|✅ Validated|All targets|Efficient short-circuiting|

</div>
The system has an on going TAC Compiler for efficient execution across both interpreter and native compilation targets.
Internal performance profiling shows that

## 5. Getting Started

Expand All @@ -155,33 +146,6 @@ java -jar coderive.jar program.cod
java -jar coderive.jar --native program.cod
```

**Compilation Output**

```
[20:26:28.018] [INFO] RUNNER: Starting MTOT compilation pipeline
[20:26:28.056] [INFO] RUNNER: AST built successfully
[20:26:28.068] [INFO] BYTECODE: Compilation complete: 1076 instructions across 9 methods
[20:26:28.227] [INFO] MTOT: Full compilation pipeline complete.
```

**Generated Assembly Sample**

A snippet of the resulting ARM64 assembly code from the compilation pipeline:

```assembly
.text
.global add
add:
stp x29, x30, [sp, #-16]!
mov x29, sp
sub sp, sp, #48
// Saving callee-saved registers
stp x19, x20, [x29, #-16]
// ... ARM64 assembly code
mov x0, x23
ret
```

## 6. Current Status

<div align="center">
Expand All @@ -190,9 +154,7 @@ add:
|---------|------|-----|
|Interpreter|✅ Complete|Full language features|
|Native Code Generation|✅ Complete|ARM64/x86_64 support|
|Register Allocation|✅ Complete|Predictive spilling|
|String Handling|🔧 In Progress|Enhanced implementation|
|Type System|🔧 In Progress|Extended features|
|TAC Compiler|🔧 In Progress|Enhanced implementation|

</div>

Expand Down
1 change: 0 additions & 1 deletion lib/.nodata

This file was deleted.

Binary file removed lib/antlr4-runtime-4.13.2.jar
Binary file not shown.
99 changes: 67 additions & 32 deletions src/main/cod/ArrayTest.cod
Original file line number Diff line number Diff line change
@@ -1,32 +1,67 @@
unit sample get {
cod.Math
}

share ArrayTest {
share main() {
// Array declaration and initialization
int[] numbers = [1, 2, 3, 4, 5]
output "Array: " + numbers

// Array access
output "First element: " + numbers[0]
output "Third element: " + numbers[2]

// String array
string[] names = ["Alice", "Bob", "Charlie"]
output "Names: " + names
output "Second name: " + names[1]

// Array assignment
numbers[0] = 100
output "After assignment - First element: " + numbers[0]

// Empty array
int[] empty = []
output "Empty array: " + empty

// Single element array
int[] single = [42]
output "Single element: " + single[0]
}
}
use {
lang.Sys,
lang.Math
}

// Test 2 - Should work based on parseTypeReference() output
local test2() :: arr: [int] {
~> arr: [1, 2, 3]
}

share main() {
// Array declaration and initialization
numbers: [int] = [1, 2, 3, 4, 5]
Sys.println("Array: " + numbers)

// Array access
Sys.println("First element: " + numbers[0])
Sys.println("Third element: " + numbers[2])

// String array
names: [text] = ["Alice", "Bob", "Charlie"]
Sys.println("Names: " + names)
Sys.println("Second name: " + names[1])

// Array assignment
numbers[0] = 100
Sys.println("After assignment - First element: " + numbers[0])

// Empty array
empty := []
Sys.println("Empty array: " + empty)

// Single element array
single: [] = [42]
Sys.println("Single element: " + single[0])

x := [1 to 10]
Sys.println("Simple natural array: " + x[2])

Sys.println("Big number: " + 9.999Qi)

x = [by 2 in 168 to 9.999Qi]
Sys.println("Multiplicative natural array: ")
Sys.println("Before mutation: " + x[20000])
x[20000] = "hello"
Sys.println("After mutation: " + x[20000])

x = [[1 to 10]]
Sys.println("Simple nested natural array: " + x[0][2])

x = [[1 to 10], [by 2 in 3 to 100]]
Sys.println("Nested natural array: " + x[1][5])

x = ["a" to "Zz"]
Sys.println("Alphabet natural array: " + x[52])

range := [1 to 10]
container := [range]
Sys.println(range[5])
Sys.println(container[0][1])
Sys.println(container[0][5])

// Test string formatting
Sys.println("Test: |" + "trailing space " + "|")
Sys.println("Number: " + 40168)
Sys.println(9.999Qi)
}
19 changes: 9 additions & 10 deletions src/main/cod/EvenOdd.cod
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
share EvenOdd {

share main() {
int number = 5
output "The number is " + number
if (number % 2) == 0 {
output "The number is even."
} else {
output "The number is odd."
}
}
use {
lang.Sys
}

number := 5
Sys.outln("The number is " + number)
if (number % 2) == 0 {
Sys.outln("The number is even.")
} else {
Sys.outln("The number is odd.")
}
29 changes: 16 additions & 13 deletions src/main/cod/ImportTest.cod
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
unit sample get {
cod.Math
unit sample

use {
lang.Sys,
lang.Math
}

share ImportTest {

share testMathOperations() {
output "=== Testing Math Import ==="
Sys.outln("=== Testing Math Import ===")

// Test calling imported math functions
sqrtResult = [result]:cod.Math.sqrt(16)
output "Square root of 16: " + sqrtResult
sqrtResult := [0]:Math.sqrt(16)
Sys.outln("Square root of 16: " + sqrtResult)

powResult = [result]:cod.Math.pow(2, 3)
output "2 to the power of 3: " + powResult
powResult := [0]:Math.pow(2, 3)
Sys.outln("2 to the power of 3: " + powResult)

maxResult = [result]:cod.Math.max(10, 20)
output "Maximum of 10 and 20: " + maxResult
maxResult := [0]:Math.max(10, 20)
Sys.outln("Maximum of 10 and 20: " + maxResult)
}

share main() {
output "=== IMPORT SYSTEM TEST ==="
output ""
Sys.outln("=== IMPORT SYSTEM TEST ===")
Sys.outln("")

testMathOperations()
output ""
Sys.outln("")

output "=== TEST COMPLETE ==="
Sys.outln("=== TEST COMPLETE ===")
}
}
Loading
Loading