A lightweight, interpreted programming language
C-like syntax โข No explicit typing โข Built-in GUI, Networking, Neural Networks
"Ascension IS the syntax" โ The same language, multiple implementations.
Ascension is an educational programming language with C-like syntax and dynamic typing. Write once, run on Python (reference implementation) or C++ (high-performance port).
Ascension is the syntax. The implementation is just how you run it:
# Run a program
python3 ascension_12_8.py examples/hello.asc
# Interactive shell
python3 ascension_shell_12_7.pyFull-featured, batteries-included, perfect for rapid development.
# Compile
g++ -std=c++17 cpp/ascension.cpp -o ascension
# With optional features
g++ -std=c++17 -DHAS_CURSES -DHAS_NETWORK cpp/ascension.cpp -o ascension -lncurses
# Run
./ascension examples/hello.ascHeader-only modular design, 15% more compact, blazing fast.
Compile Flags:
-DHAS_CURSESโ Terminal UI support (requires ncurses)-DHAS_NETWORKโ HTTP and socket networking
- C-like Syntax โ Familiar and easy to learn
- No Explicit Typing โ Variables are dynamically typed
- Stack-based VM โ Compiled to bytecode, then executed
- GUI Support โ Built-in Tkinter integration
- Networking โ HTTP requests and TCP sockets
- File I/O โ Read, write, and manage files
- Terminal UI โ Curses support for console apps
- Math Functions โ Trigonometry, random, exponentials (v12.7)
- Neural Networks โ Built-in library for ML experiments (v12.7)
- Terminal Size Detection โ
curses_rows(),curses_cols()for dynamic TUI layouts (v12.8)
name = "Ascension";
version = 12.8;
print("Welcome to", name, "v" + version);
func factorial(n) {
if (n <= 1) {
return 1;
}
return n * factorial(n - 1);
}
print("5! =", factorial(5)); // Output: 120
for (i = 0; i < 5; i += 1) {
if (i % 2 == 0) {
print(i, "is even");
} else {
print(i, "is odd");
}
}
struct Person { name, age, city };
p = new Person;
p.name = "Alice";
p.age = 30;
p.city = "Rome";
print(p.name, "lives in", p.city);
// 1D Array
numbers = [10, 20, 30, 40, 50];
print("First:", numbers[0]);
// 2D Matrix
grid = matrix(3, 3, 0);
grid[1, 1] = 99;
print("Center:", grid[1, 1]);
// Write to file
f = open("data.txt", "w");
write(f, "Hello, File!\n");
close(f);
// Read from file
f = open("data.txt", "r");
content = read_all(f);
print(content);
close(f);
response = http_get("https://api.github.com");
status = response_status(response);
body = response_body(response);
print("Status:", status);
sock = socket_open();
socket_connect(sock, "example.com", 80);
socket_send(sock, "GET / HTTP/1.0\r\n\r\n");
data = socket_recv(sock, 1024);
socket_close(sock);
print(data);
root = tk_root("My App", "400x300");
label = tk_widget(root, "label", "text=Hello GUI!");
tk_pack(label);
button = tk_widget(root, "button", "text=Click Me");
tk_pack(button);
tk_mainloop(root);
scr = curses_init();
curses_print(scr, 0, 0, "Press any key...");
curses_refresh(scr);
key = curses_getkey(scr);
curses_end(scr);
print("You pressed:", key);
try {
x = 10 / 0;
} catch {
print("Caught an error!");
}
result = exec("ls -la");
print(result);
system("echo 'Hello from shell!'");
text = "Hello, World!";
print("Length:", len(text));
print("Substring:", substr(text, 0, 5)); // "Hello"
print("Char code:", ord("A")); // 65
print("From code:", chr(65)); // "A"
// Random numbers
r = random(); // Float 0.0 - 1.0
r = random(100); // Int 0 - 99
r = random(10, 20); // Int 10 - 19
// Basic math
print(sqrt(16)); // 4
print(pow(2, 10)); // 1024
print(abs(-42)); // 42
print(floor(3.7)); // 3
print(ceil(3.2)); // 4
// Exponential and logarithm
print(exp(1)); // 2.718... (e)
print(log(E)); // 1.0
// Trigonometry
print(sin(PI / 2)); // 1.0
print(cos(0)); // 1.0
print(tan(PI / 4)); // 1.0
print(atan2(1, 1)); // 0.785... (PI/4)
// Constants
print(PI); // 3.14159...
print(E); // 2.71828...
Ascension includes neural_network.asc, a library for building and training neural networks:
include "lib/neural_network.asc";
// Sigmoid activation
print(sigmoid(0)); // 0.5
print(sigmoid(5)); // ~0.99
// Initialize MLP (2 inputs, 2 hidden, 1 output)
mlp_init();
// Train on XOR problem
// ... training loop ...
// Predict
result = mlp_predict(1, 0); // ~0.99 (XOR: 1)
result = mlp_predict(1, 1); // ~0.01 (XOR: 0)
// Save/Load weights
mlp_save_weights("xor_trained.weights");
mlp_load_weights("xor_trained.weights");
Features:
- Activation functions: sigmoid, relu, step, tanh
- Single neuron implementation
- Perceptron with training (AND/OR gates)
- Multi-Layer Perceptron (MLP) with backpropagation
- XOR problem solver (2-2-1 architecture)
- Weight persistence (save/load to file)
| Category | Functions |
|---|---|
| I/O | print, read |
| Math | sqrt, pow, exp, log, abs, floor, ceil, random |
| Trig | sin, cos, tan, asin, acos, atan, atan2 |
| String | len, substr, chr, ord, to_int, to_float |
| Array | matrix, rows, cols, dim, keys |
| File | open, close, read_line, read_all, write |
| Network | http_get, http_post, response_status, response_body |
| Socket | socket_open, socket_connect, socket_send, socket_recv, socket_close, socket_bind, socket_listen, socket_accept, get_ip |
| GUI | tk_root, tk_widget, tk_pack, tk_grid, tk_bind, tk_mainloop, tk_canvas_*, tk_dialog_* |
| TUI | curses_init, curses_end, curses_print, curses_refresh, curses_getkey, curses_clear, curses_rows, curses_cols |
| System | system, exec |
| Category | Keywords |
|---|---|
| Control | if, else, for, while, switch, case, default, break, continue |
| Functions | func, return |
| Data | struct, new, null, true, false |
| Error | try, catch, throw |
| Module | include |
| Constants | PI, E |
โ
Sieve of Eratosthenes โ 1,000,000 numbers, found all 78,498 primes up to 999,983
โ
Neural Network XOR โ MLP 2-2-1 with backpropagation
โ
Recursive Fibonacci โ Deep recursion handling
โ
Nested loops โ Complex iteration patterns
ascension/
โโโ ascension_12_8.py # Main interpreter (v12.8 Atomo Edition)
โโโ ascension_shell_12_7.py # Interactive REPL shell
โโโ cpp/ # C++ implementation
โ โโโ ascension.cpp # Main C++ interpreter
โ โโโ value.hpp # Value types
โ โโโ compiler.hpp # Bytecode compiler
โ โโโ vm.hpp # Virtual machine
โ โโโ modules/ # Optional modules
โ โโโ mod_fileio.hpp # File I/O (always included)
โ โโโ mod_curses.hpp # Terminal UI (optional)
โ โโโ mod_network.hpp # HTTP/Sockets (optional)
โโโ ascension_examples/ # Example programs
โ โโโ hello.asc
โ โโโ calculator.asc
โ โโโ fibonacci.asc
โ โโโ sieve.asc # Sieve of Eratosthenes (tested on 1M numbers!)
โ โโโ ...
โโโ lib/ # Libraries
โ โโโ neural_network.asc # Neural network library
โ โโโ nn_demo.asc # Neural network demo
โโโ docs/ # Documentation
โ โโโ ascension_manual.pdf
โโโ LICENSE # GPL v3
โโโ README.md
- User Manual (PDF) โ Complete 21-chapter guide
- Shell Guide โ Interactive REPL documentation
- Examples โ Sample programs
| Version | Name | Highlights |
|---|---|---|
| 12.8 | Atomo Edition | curses_rows(), curses_cols() โ terminal size detection for dynamic TUI |
| 12.7 | Math Edition | 17 math functions, neural network library, PI/E constants |
| 12.6 | Substr Edition | substr(), chr() string functions |
| 12.5 | String Edition | Enhanced string operations |
| 12.4 | System Edition | system(), exec() commands |
| 12.3 | Matrix Edition | 2D arrays, matrix() function |
EdeFede โ GitHub
Created through "vibe coding" with LLMs, exploring programming language development and generative thinking patterns.
This project is licensed under the GPL v3 License. See LICENSE for details.
Remember: Whether you choose Python for rapid development or C++ for performance, you're writing the same Ascension language. The implementation is just a detail โ Ascension IS the syntax.
// The same code runs on both implementations
func main() {
print("One language. Multiple runtimes. Infinite possibilities.");
}