An open API service indexing awesome lists of open source software.

https://github.com/aarav90-cpu/arkcode

A Coding Language Based on C++
https://github.com/aarav90-cpu/arkcode

coding coding-lang cpp custom-code language

Last synced: about 4 hours ago
JSON representation

A Coding Language Based on C++

Awesome Lists containing this project

README

          

# ArkCode

ArkCode (`.arkc`) is an ultra-fast, "easy as hell" minimalist programming language designed for rapid application and UI development. It merges the clean block-builder syntax of Kotlin and the simplicity of Python.

## Core Tenets
1. **Speed & Ease**: Parsing and compilation is powered by the `aake` compiler, written entirely in C++ for maximum speed.
2. **Minimalist UI/DSL Builders**: Clean, anonymous code blocks with builder patterns.
3. **No Boilerplate**: No main classes needed for scripts.

## The Compiler (`aake`)
The ArkCode compiler/interpreter is built in C++. For full detailed documentation, please check out the official [ArkCode Documentation Website](https://aarav90-cpu.github.io/arkcode/)!

### Dependencies Required
- **C++17 Compiler** (GCC, Clang)
- **CMake** (v3.10+)
- **GTK+3** (for the native UI engine)

### Compiling `aake`
You can compile it via standard CMake or via the included Makefile:
```bash
make aake
# or
sudo make aake
```

### ArkCode CLI Commands
Once compiled, you can use the built-in compiler commands:
```bash
aake # Runs a script using the JIT interpreter
aake build # Transpiles script to optimized C++ and compiles to native executable
aake project create # Scaffolds a new ArkCode project structure
aake clean # Cleans compilation cache and build artifacts
aake test # Automatically compiles and runs the master test suite
aake lsp # Runs the Language Server Protocol (LSP) server
```

You can also append the `--hot` flag to any UI script execution to enable **UI Hot Reloading**.

### Running and Testing ArkCode
```bash
# Run the automated test suite
./build/aake test

# Run a specific script
./build/aake examples/test.arkc
```

## Why ArkCode? (Fixing C++)
C++ is incredibly powerful, but developers frequently cite major pain points. ArkCode was built precisely to patch these fundamental flaws while keeping the raw speed of a native C++ engine:

1. **Memory Safety & Vulnerability Protection (ARC, SSO & Guards)**: ArkCode entirely eliminates raw pointers and manual memory management. Value types are backed by `RcValue` (Automatic Reference Counting via `std::shared_ptr`). String operations are accelerated using `SsoString` with Small String Optimization (SSO) inline buffers. The compiler and interpreter enforce low-level buffer overflow protections (CWE-121 / CWE-787 in socket servers) and out-of-bounds read guards (CWE-125 in LSP JSON parsing, diagnostics, and library functions).
2. **Syntax and Language Complexity**: We removed the "too many ways to do it" problem. Comments support C++ (`//`, `/* */`) and Python (`#`) styles. All compiler error logs are standardized with the `[ArkCode Error]` prefix, and the compiler performs static analysis to output `[ArkCode Warning]` diagnostics (e.g. warning when a mutable `varue` variable is never reassigned, or when packages are imported over insecure URLs).
3. **Tooling and Ecosystem**: C++ tooling is notoriously fragmented. ArkCode ships with `aake`—a built-in compiler, package manager, and test runner. It features **Decentralized Package Management** allowing package imports directly from secure HTTP URLs (e.g., `import "https://..."`) with local caching under `.aake_cache`. It also hosts a custom **Language Server Protocol (LSP)** (`aake lsp`) for IDE integration and a **UI Hot Reloading** watcher (`--hot`).
4. **Standard Library & Native Diagnostics**: ArkCode features standard library expansions including `fsread`, `fswrite`, flat JSON parse/stringify (`jsonparse`, `jsonstringify`), and networking (`netget`, `netpost`, and a high-performance TCP socket server `netserver`). It also includes native built-in functions for system execution and testing (`exec`, `runcmd`, `strrepeat`, `sleep`, and `printsummary`). Additionally, native signal handlers capture low-level segmentation faults and map them back to the exact ArkCode line and column using thread-local source maps.

## Syntax

ArkCode is incredibly simple and borrows paradigms directly from Kotlin:
- `value`: Exactly like Kotlin's `val` (immutable).
- `varue`: Exactly like Kotlin's `var` (mutable).

```arkc
value greeting = "Hello from ArkCode!"
print(greeting)

varue number = 42

spawnfile("my_test_file.txt")
spawnfolder("my_test_folder")

ark(
print("This is inside an anonymous ark block!")
)

ark main() {
print("Inside named main function!")
}
```

## UI Builder Support
ArkCode treats DSLs natively:
```arkc
pack my_app
import std.ui

ark(
std.ui.drawwindow("TEST") {
Button(height = 34, width = 56) {
text = "hi"
}
}
)
```

## Community
Join the discussion on the official subreddit: [r/arkcode](https://www.reddit.com/r/arkcode/)

## License
ArkCode is licensed under the Apache License 2.0.