Skip to content

Commit d50369b

Browse files
committed
v0.5.0 Updates dependencies like BoaJS under Rust. The full compiler with all Javascript transpilers (x10) are released (since I was reserving that code). Includes also new experimental languages: Rust, PHP, C#.
1 parent 7bd2c95 commit d50369b

18 files changed

Lines changed: 4943 additions & 40 deletions

.gitignore

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,20 @@
33
/abcodec-mac
44
/abcodec.exe
55
/abcodec*.zip
6-
/abcodejs/*
7-
!abcodejs/abctest.js
6+
/abcodejs/dart.js
7+
/abcodejs/elixir.js
8+
/abcodejs/ruby.js
9+
/abcodejs/lua.js
10+
/abcodejs/tstl.js
11+
/abcodejs/gleam.js
12+
/abcodejs/*.md
813
/run/*
914
!run/hello.js
10-
/target
11-
/dist
15+
target
16+
dist
17+
/web
1218
Cargo.lock
1319
*.pdf
14-
*.zip
20+
*.zip
21+
test_*
22+
temp_*

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[package]
22
name = "abcodec"
3-
version = "0.4.0"
4-
edition = "2021"
3+
version = "0.5.0"
4+
edition = "2024"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
99
clap = { version = "4.5", features = ["derive"] }
10-
rust-embed = "8.7"
11-
boa_engine = "0.20"
10+
rust-embed = "8.9"
11+
boa_engine = "0.21"

README.md

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ABCode Programming Language - Version 1 (Preview/Alpha)
1+
# ABCode Programming Language
22

33
> Mitigating the Software Tower of Babel to a great degree
44
> [**Download...**](https://github.com/kaesar/abcode/releases) | [Video](https://www.youtube.com/embed/GuPJzq43FbY)
@@ -7,14 +7,78 @@
77

88
![](https://assets.onmind.net/know/onmind22-abcode.gif)
99

10+
## Quick Start
11+
1012
Just download and uncompress according to your system and run something like...
1113

1214
```bash
1315
./abcodec -s abc/hello.abc
1416
```
1517

1618
> `abcodec` is the compiler and `abc/hello.abc` represent your source code with **ABCode**.
17-
> Go to [`ABCode`](https://onmind.co/doc/code/en/ABCode.md) topic in my blog.
19+
> Go to [`ABCode`](https://onmind.net/onmind/en/ABCode) topic in my blog.
20+
21+
## Supported Targets
22+
23+
| Target | Language | Extension |
24+
|--------|-------------|-----------|
25+
| 1 | NodeJS | .js |
26+
| 2 | Deno | .ts |
27+
| 3 | WebAssembly | .ts |
28+
| 4 | Kotlin | .kt |
29+
| 5 | Java | .java |
30+
| 6 | Python | .py |
31+
| 7 | Go | .go |
32+
| 8 | PHP | .php |
33+
| 9 | C# | .cs |
34+
| 0 | Rust | .rs |
35+
36+
<!--
37+
## Project Structure
38+
39+
```
40+
abcode/
41+
├── src/main.rs # CLI Compiler (abcodec)
42+
├── abc/ # ABCode examples
43+
├── abcodejs/ # JavaScript transpilers
44+
├── abcodelib/ # ABCode as library
45+
├── abcodeweb/ # Web interface (like playground)
46+
├── abcoderun/ # ABCode script runtime (under CLI)
47+
├── abcodefun/ # ABCode Web Runtime for Functions
48+
└── abcodeext/ # ABCode extensions for Editors
49+
```
50+
51+
### Components
52+
53+
- **`abcodec`**: Command-line compiler for ABCode under Rust
54+
- **`abcodejs`**: JavaScript transpilers (used by all components via BoaJS)
55+
- **`abcodelib`**: ABCode compilation as Rust library
56+
- **`abcodeweb`**: Web UI for online compilation and preview (like playground)
57+
- **`abcoderun`**: Direct ABCode script execution runtime (under CLI)
58+
- **`abcodefun`**: ABCode Web Runtime for Functions execution platform (AWS Lambda-style)
59+
- **`abcodeext`**: ABCode extensions for Editors (VSCode, Intellij, Vim, Zed, Lapce, Sublime, ACE.js)
60+
-->
61+
### Usage
62+
63+
```bash
64+
# CLI Compiler
65+
cargo build --release
66+
./target/release/abcodec -s abc/hello.abc -t 1
67+
68+
# Web Interface
69+
cd abcodeweb && cargo run
70+
# Visit http://localhost:3000
71+
72+
# Serverless Functions
73+
cd abcodefun && cargo run
74+
# POST http://localhost:3001/invoke
75+
76+
# Runtime
77+
cd abcoderun && cargo run example.abc
78+
79+
# Library
80+
cd abcodelib && cargo build
81+
```
1882

1983
---
2084
<!--
@@ -37,4 +101,4 @@ rustup target add aarch64-unknown-linux-gnu
37101
Building script with: `build.sh`
38102
-->
39103

40-
> © 2021-2025 by César Andres Arcila Buitrago
104+
> © 2021-2026 by César Andres Arcila Buitrago

abc/server.abc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
use: api
1+
use: @api
22

3-
web: :server = app
3+
web: @server = app
44

55
do: get("/") = index
6-
web: :handle = {"hello":"there!"}
6+
web: @handle = {"hello":"there!"}
77

88
fun: main()
9-
web: :routes
10-
web: :listen = 8000
9+
web: @routes
10+
web: @listen = 8000
1111
echo: "Server ready to listening..." + 8000
1212

1313
run: main()

abc/test.abc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
#type: Test
2-
use: api
3-
#use: mongodb
2+
use: @api
3+
use: @mongodb
44

5-
web: :server = app
5+
web: @server = app
66

77
do: get("/") = index
8-
web: :handle = {"hello":"there!"}
8+
echo: "ok"
9+
web: @handle = {"hello":"there!"}
910

1011
fun: suma(a:int, b:int):int
1112
echo: "sumando..."
1213
pass: a + b
1314

1415
fun: db()
15-
dbc: :link = "mongodb://localhost:27017/xy"
16+
dbc: @link = "mongodb://localhost:27017/xy"
1617
dbc: mydb := "xy"
1718
echo: "Database connected!"
1819
#pass: dbc
@@ -27,8 +28,8 @@ fun: main()
2728
for: i in range(0,len(z))
2829
if: i == 1
2930
echo: i
30-
web: :routes
31-
web: :listen = port
31+
web: @routes
32+
web: @listen = port
3233
echo: "Server ready to listening at " + port
3334

3435
run: main()

abcodejs/abchelper.js

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
// © 2021-2025 by César Andres Arcila Buitrago
2+
3+
const console = {
4+
messages: [],
5+
log: function(message) {
6+
this.messages.push("LOG: " + message);
7+
},
8+
info: function(message) {
9+
this.messages.push("INFO: " + message);
10+
},
11+
warn: function(message) {
12+
this.messages.push("WARN: " + message);
13+
},
14+
error: function(message) {
15+
this.messages.push("ERROR: " + message);
16+
}
17+
}
18+
19+
function getConsole() {
20+
return console.messages.join('\n');
21+
}
22+
23+
String.prototype.substr = function(start, length) {
24+
if (start < 0) {
25+
start = this.length + start;
26+
if (start < 0) start = 0;
27+
}
28+
if (length === undefined) {
29+
return this.substring(start);
30+
}
31+
if (length < 0) {
32+
return '';
33+
}
34+
return this.substring(start, start + length);
35+
}
36+
/*
37+
// Implementación de Array.prototype.findIndex si no existe
38+
if (!Array.prototype.findIndex) {
39+
Array.prototype.findIndex = function(predicate) {
40+
if (this == null) {
41+
throw new TypeError('Array.prototype.findIndex called on null or undefined');
42+
}
43+
if (typeof predicate !== 'function') {
44+
throw new TypeError('predicate must be a function');
45+
}
46+
47+
const list = Object(this);
48+
const length = list.length >>> 0;
49+
const thisArg = arguments[1];
50+
51+
for (let i = 0; i < length; i++) {
52+
if (i in list && predicate.call(thisArg, list[i], i, list)) {
53+
return i;
54+
}
55+
}
56+
57+
return -1;
58+
};
59+
}
60+
61+
// Implementación de Array.prototype.find si no existe
62+
if (!Array.prototype.find) {
63+
Array.prototype.find = function(predicate) {
64+
if (this == null) {
65+
throw new TypeError('Array.prototype.find called on null or undefined');
66+
}
67+
if (typeof predicate !== 'function') {
68+
throw new TypeError('predicate must be a function');
69+
}
70+
71+
const list = Object(this);
72+
const length = list.length >>> 0;
73+
const thisArg = arguments[1];
74+
75+
for (let i = 0; i < length; i++) {
76+
if (i in list && predicate.call(thisArg, list[i], i, list)) {
77+
return list[i];
78+
}
79+
}
80+
81+
return undefined;
82+
};
83+
}
84+
85+
// Implementación de Array.prototype.splice si no existe o no funciona correctamente
86+
if (!Array.prototype.splice || typeof Array.prototype.splice !== 'function') {
87+
Array.prototype.splice = function(start, deleteCount) {
88+
if (this == null) {
89+
throw new TypeError('Array.prototype.splice called on null or undefined');
90+
}
91+
92+
const array = Object(this);
93+
const len = array.length >>> 0;
94+
95+
// Convertir start a un entero
96+
start = parseInt(start, 10) || 0;
97+
if (start < 0) {
98+
start = Math.max(len + start, 0);
99+
} else {
100+
start = Math.min(start, len);
101+
}
102+
103+
// Convertir deleteCount a un entero
104+
deleteCount = parseInt(deleteCount, 10) || 0;
105+
deleteCount = Math.max(0, Math.min(deleteCount, len - start));
106+
107+
// Elementos a insertar
108+
const itemCount = arguments.length - 2;
109+
const removed = new Array(deleteCount);
110+
111+
// Guardar elementos eliminados
112+
for (let i = 0; i < deleteCount; i++) {
113+
removed[i] = array[start + i];
114+
}
115+
116+
// Calcular cuántos elementos quedarán después de la operación
117+
const newLen = len - deleteCount + itemCount;
118+
119+
// Si hay más elementos a insertar que a eliminar, mover elementos existentes
120+
if (itemCount > deleteCount) {
121+
for (let i = len - 1; i >= start + deleteCount; i--) {
122+
array[i + (itemCount - deleteCount)] = array[i];
123+
}
124+
}
125+
// Si hay menos elementos a insertar que a eliminar, mover elementos existentes
126+
else if (itemCount < deleteCount) {
127+
for (let i = start + deleteCount; i < len; i++) {
128+
array[i - (deleteCount - itemCount)] = array[i];
129+
}
130+
// Ajustar la longitud del array
131+
array.length = newLen;
132+
}
133+
134+
// Insertar nuevos elementos
135+
for (let i = 0; i < itemCount; i++) {
136+
array[start + i] = arguments[i + 2];
137+
}
138+
139+
return removed;
140+
};
141+
}
142+
*/

0 commit comments

Comments
 (0)