vladx 1.4.1 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +20 -0
- package/CHANGELOG.md +14 -0
- package/examples/stdlib/ambiente.vx +8 -0
- package/examples/stdlib/archivio_extra.vx +11 -0
- package/examples/stdlib/asserzione.vx +11 -0
- package/examples/stdlib/client_web.vx +7 -0
- package/examples/stdlib/codifica.vx +8 -0
- package/examples/stdlib/collezioni.vx +11 -0
- package/examples/stdlib/compressione.vx +10 -0
- package/examples/stdlib/console.vx +14 -0
- package/examples/stdlib/cripto.vx +8 -0
- package/examples/stdlib/dati.vx +21 -0
- package/examples/stdlib/eventi.vx +10 -0
- package/examples/stdlib/json_extra.vx +7 -0
- package/examples/stdlib/matematica.vx +9 -0
- package/examples/stdlib/percorso.vx +9 -0
- package/examples/stdlib/processo.vx +9 -0
- package/examples/stdlib/server_web.vx +10 -0
- package/examples/stdlib/sql_helper.vx +7 -0
- package/examples/stdlib/tempo.vx +8 -0
- package/examples/stdlib/testo.vx +10 -0
- package/examples/stdlib/url.vx +11 -0
- package/examples/stdlib/validazione.vx +5 -0
- package/install.sh +13 -1
- package/package.json +3 -2
- package/plan.md +140 -0
- package/programs/1/index.vx +16 -4
- package/programs/main/index.vx +26 -10
- package/programs/main/passports/Bobik.json +1 -0
- package/programs/main/passports/Tanya.json +1 -0
- package/programs/main/passports/Vlad.json +1 -1
- package/programs/main/passports/vlad.json +1 -0
- package/programs/tests/test_global_import.vx +2 -0
- package/programs/tests/test_new_features.vx +53 -0
- package/programs/tests/test_stdlib.vx +26 -0
- package/programs/tests/test_templates.vx +8 -0
- package/scripts/install-setup.js +36 -0
- package/src/interpreter/interpreter.js +451 -127
- package/src/lexer/lexer.js +5 -1
- package/src/lexer/tokens.js +9 -1
- package/src/parser/ast.js +66 -12
- package/src/parser/parser.js +291 -78
- package/src/pm/commands/install.js +28 -7
- package/src/pm/utils/config.js +11 -1
- package/src/repl/repl.js +9 -20
- package/src/stdlib/registry.js +495 -0
- package/src/utils/errors.js +42 -0
- package/src/utils/logger.js +29 -0
- package/test_destinazione.txt +0 -0
- package/tests/phase1_test.vx +41 -0
- package/tests/phase2_test.vx +43 -0
- package/tests/std_cripto_test.vx +27 -0
- package/tests/std_flusso_test.vx +24 -0
- package/tests/std_rete_test.vx +13 -0
- package/tests/std_tempo_test.vx +17 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: VladX CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
- name: Use Node.js
|
|
16
|
+
uses: actions/setup-node@v3
|
|
17
|
+
with:
|
|
18
|
+
node-version: '18.x'
|
|
19
|
+
- run: npm install
|
|
20
|
+
- run: npm test
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [1.5.1] - 2026-02-03
|
|
8
|
+
### Added
|
|
9
|
+
- Phase 0 of the roadmap: Baseline Hygiene.
|
|
10
|
+
- Unified error handling base class `VladXError`.
|
|
11
|
+
- Simple logging utility.
|
|
12
|
+
- Project directory structure (`tests`, `benchmarks`, `docs`).
|
|
13
|
+
- Initial CI workflow for GitHub Actions.
|
|
14
|
+
- `CHANGELOG.md` to track project evolution.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
importa { elencaTutto } da "@std/ArchivioExtra";
|
|
2
|
+
|
|
3
|
+
stampa("Analisi completa cartella 'src':");
|
|
4
|
+
variabile fileSrc = elencaTutto("src");
|
|
5
|
+
|
|
6
|
+
// Mostro solo i primi 5 per brevità
|
|
7
|
+
variabile i = 0;
|
|
8
|
+
per (variabile f di fileSrc) {
|
|
9
|
+
se (i < 5) stampa("- " + f);
|
|
10
|
+
i++;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
importa { CreaMappa, CreaInsieme, chiavi, valori } da "@std/Collezioni";
|
|
2
|
+
|
|
3
|
+
stampa("--- MAPPA ---");
|
|
4
|
+
variabile m = CreaMappa();
|
|
5
|
+
m.set("chiave", "valore");
|
|
6
|
+
stampa("Contenuto mappa: " + m.get("chiave"));
|
|
7
|
+
|
|
8
|
+
stampa("\n--- OGGETTI ---");
|
|
9
|
+
variabile obj = { nome: "Vlad", versione: 1.4 };
|
|
10
|
+
stampa("Chiavi: " + chiavi(obj));
|
|
11
|
+
stampa("Valori: " + valori(obj));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
importa { comprimi, decomprimi } da "@std/Compressione";
|
|
2
|
+
|
|
3
|
+
variabile segreto = "Questo è un messaggio molto lungo che vogliamo comprimere.";
|
|
4
|
+
stampa("Originale (" + lunghezza(segreto) + " byte): " + segreto);
|
|
5
|
+
|
|
6
|
+
variabile compresso = comprimi(segreto);
|
|
7
|
+
stampa("Compresso (Base64): " + compresso);
|
|
8
|
+
|
|
9
|
+
variabile decompresso = decomprimi(compresso);
|
|
10
|
+
stampa("Decompresso: " + decompresso);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
importa { log, errore, avviso, successo, tabella } da "@std/Console";
|
|
2
|
+
|
|
3
|
+
log("Semplice log di sistema");
|
|
4
|
+
successo("Operazione completata con successo!");
|
|
5
|
+
avviso("Attenzione: valore instabile.");
|
|
6
|
+
errore("Errore critico rilevato!");
|
|
7
|
+
|
|
8
|
+
variabile dati = [
|
|
9
|
+
{ id: 1, nome: "Vlad" },
|
|
10
|
+
{ id: 2, nome: "Rex" }
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
stampa("\nVisualizzazione tabella:");
|
|
14
|
+
tabella(dati);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
importa { sha256, md5, uuid, casuale } da "@std/Cripto";
|
|
2
|
+
|
|
3
|
+
stampa("Generazione UUID: " + uuid());
|
|
4
|
+
stampa("Token casuale (Hex): " + casuale(32));
|
|
5
|
+
|
|
6
|
+
variabile password = "vlad_password_sicura";
|
|
7
|
+
stampa("SHA256: " + sha256(password));
|
|
8
|
+
stampa("MD5: " + md5(password));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
importa { clona, fondi, raggruppa } da "@std/Dati";
|
|
2
|
+
|
|
3
|
+
stampa("--- CLONE ---");
|
|
4
|
+
variabile a = { x: 1 };
|
|
5
|
+
variabile b = clona(a);
|
|
6
|
+
b.x = 2;
|
|
7
|
+
stampa("a.x (dovrebbe essere 1): " + a.x);
|
|
8
|
+
|
|
9
|
+
stampa("\n--- MERGE ---");
|
|
10
|
+
variabile base = { nome: "Vlad" };
|
|
11
|
+
variabile extra = { eta: 25 };
|
|
12
|
+
fondi(base, extra);
|
|
13
|
+
stampa(base);
|
|
14
|
+
|
|
15
|
+
stampa("\n--- GROUP BY ---");
|
|
16
|
+
variabile persone = [
|
|
17
|
+
{ nome: "Luca", citta: "Roma" },
|
|
18
|
+
{ nome: "Sara", citta: "Milano" },
|
|
19
|
+
{ nome: "Marco", citta: "Roma" }
|
|
20
|
+
];
|
|
21
|
+
stampa(raggruppa(persone, "citta"));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
importa { piGreco, radice, casuale, rotonda, max } da "@std/Matematica";
|
|
2
|
+
|
|
3
|
+
stampa("Valore di PI: " + piGreco);
|
|
4
|
+
stampa("Radice di 144: " + radice(144));
|
|
5
|
+
stampa("Arrotonda 4.7: " + rotonda(4.7));
|
|
6
|
+
stampa("Massimo tra 10, 50, 20: " + max(10, 50, 20));
|
|
7
|
+
|
|
8
|
+
variabile n = casuale() * 10;
|
|
9
|
+
stampa("Numero casuale 0-10: " + rotonda(n));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
importa { unisci, base, cartella, estensione, assoluto } da "@std/Percorso";
|
|
2
|
+
|
|
3
|
+
variabile mioFile = "/home/utente/progetti/test.vx";
|
|
4
|
+
|
|
5
|
+
stampa("File: " + mioFile);
|
|
6
|
+
stampa("Base: " + base(mioFile));
|
|
7
|
+
stampa("Cartella: " + cartella(mioFile));
|
|
8
|
+
stampa("Estensione: " + estensione(mioFile));
|
|
9
|
+
stampa("Percorso assoluto di 'src': " + assoluto("src"));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
importa { id, memoria, piattaforma, versioneNode } da "@std/Processo";
|
|
2
|
+
|
|
3
|
+
stampa("--- INFO PROCESSO ---");
|
|
4
|
+
stampa("ID: " + id);
|
|
5
|
+
stampa("Piattaforma: " + piattaforma);
|
|
6
|
+
stampa("Node Version: " + versioneNode);
|
|
7
|
+
|
|
8
|
+
stampa("\nUso memoria:");
|
|
9
|
+
stampa(memoria());
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
importa { rispondiJson, errore } da "@std/ServerWeb";
|
|
2
|
+
|
|
3
|
+
// Esempio d'uso teorico con Rete.server (vedi documentazione)
|
|
4
|
+
// gestore = (richiesta) => {
|
|
5
|
+
// ritorna rispondiJson({ stato: "ok", msg: "Ciao da VladX" });
|
|
6
|
+
// };
|
|
7
|
+
|
|
8
|
+
variabile resp = rispondiJson({ id: 1 });
|
|
9
|
+
stampa("Esempio risposta JSON:");
|
|
10
|
+
stampa(resp);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
importa { maiuscolo, minuscolo, capitalizza, slugify, pulisci } da "@std/Testo";
|
|
2
|
+
|
|
3
|
+
variabile testo = " vladx è fantastico ";
|
|
4
|
+
|
|
5
|
+
stampa("Originale: '" + testo + "'");
|
|
6
|
+
stampa("Pulisci: '" + pulisci(testo) + "'");
|
|
7
|
+
stampa("Maiuscolo: " + maiuscolo(testo));
|
|
8
|
+
stampa("Minuscolo: " + minuscolo(testo));
|
|
9
|
+
stampa("Capitalizza: " + capitalizza("vlad"));
|
|
10
|
+
stampa("Slugify: " + slugify("Benvenuti su VladX 2.0!"));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
importa { analizza, componi } da "@std/Url";
|
|
2
|
+
|
|
3
|
+
variabile link = "https://vladx.org/search?q=syntax&lang=it#top";
|
|
4
|
+
variabile info = analizza(link);
|
|
5
|
+
|
|
6
|
+
stampa("Host: " + info.host);
|
|
7
|
+
stampa("Protocollo: " + info.protocollo);
|
|
8
|
+
stampa("Query: " + info.query.q);
|
|
9
|
+
|
|
10
|
+
variabile nuovoLink = componi("https://api.test.com", { chiave: "123", utente: "vlad" });
|
|
11
|
+
stampa("Nuovo URL: " + nuovoLink);
|
package/install.sh
CHANGED
|
@@ -25,11 +25,23 @@ echo "🌐 Installazione dell'ultima versione di Node.js..."
|
|
|
25
25
|
nvm install node
|
|
26
26
|
nvm use node
|
|
27
27
|
|
|
28
|
-
# 3.
|
|
28
|
+
# 3. Preparazione directory VladX
|
|
29
|
+
echo "📁 Preparazione directory dati (~/.vladx)..."
|
|
30
|
+
mkdir -p "$HOME/.vladx/vladpm/bin"
|
|
31
|
+
|
|
32
|
+
# 4. Installazione VladX
|
|
29
33
|
echo "🛠️ Installazione globale di VladX e VladPM dal registry NPM..."
|
|
30
34
|
|
|
31
35
|
npm install -g vladx
|
|
32
36
|
|
|
37
|
+
# 5. Configurazione PATH
|
|
38
|
+
echo "🌐 Configurazione PATH..."
|
|
39
|
+
if [[ ":$PATH:" != *":$HOME/.vladx/vladpm/bin:"* ]]; then
|
|
40
|
+
echo 'export PATH="$HOME/.vladx/vladpm/bin:$PATH"' >> "$HOME/.bashrc"
|
|
41
|
+
echo " ✓ Aggiunto ~/.vladx/vladpm/bin a .bashrc"
|
|
42
|
+
export PATH="$HOME/.vladx/vladpm/bin:$PATH"
|
|
43
|
+
fi
|
|
44
|
+
|
|
33
45
|
echo ""
|
|
34
46
|
echo "✅ Installazione completata con successo!"
|
|
35
47
|
echo "Node.js: $(node -v)"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vladx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "VladX - Linguaggio di programmazione con sintassi italiana",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"start": "node bin/vladx",
|
|
13
|
-
"repl": "node bin/vladx repl"
|
|
13
|
+
"repl": "node bin/vladx repl",
|
|
14
|
+
"postinstall": "node scripts/install-setup.js"
|
|
14
15
|
},
|
|
15
16
|
"keywords": [
|
|
16
17
|
"language",
|
package/plan.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# VladX Roadmap to Node.js‑Level Capability
|
|
2
|
+
|
|
3
|
+
This plan is an exhaustive, practical checklist to move VladX from a scripting interpreter toward a Node.js‑class runtime, ecosystem, and developer experience. It is intentionally ambitious and staged. “Node.js‑level” means a non‑blocking runtime, stable core APIs, a robust package ecosystem, strong tooling, security hardening, and measurable performance.
|
|
4
|
+
|
|
5
|
+
## Principles
|
|
6
|
+
- Preserve Italian syntax and identity while matching Node’s technical quality.
|
|
7
|
+
- Prioritize correctness, security, and developer experience before performance optimizations.
|
|
8
|
+
- Avoid breaking changes without clear migrations.
|
|
9
|
+
- Automate quality gates early.
|
|
10
|
+
|
|
11
|
+
## Phase 0 — Baseline Hygiene (Immediate)
|
|
12
|
+
- Add a formal versioning strategy (SemVer + changelog).
|
|
13
|
+
- Add a consistent error format with file/line/column everywhere.
|
|
14
|
+
- Add a logging strategy for runtime and PM.
|
|
15
|
+
- Create a repo directory standard for tests, benchmarks, and docs.
|
|
16
|
+
- Add CI with linting, tests, and packaging validation.
|
|
17
|
+
|
|
18
|
+
## Phase 1 — Correctness Fixes (Must‑Fix Bugs)
|
|
19
|
+
- Fix file path resolution in `Archivio.*` to be relative to the executing file’s directory, not `..` from a file path.
|
|
20
|
+
- Fix REPL last expression evaluation environment so it actually uses current scope.
|
|
21
|
+
- Fix `new` parsing to accept `nuovo` on member expressions, not only identifiers.
|
|
22
|
+
- Fix optional chaining support to include `obj?.[expr]` and `obj?.(args)`.
|
|
23
|
+
- Add clear error when calling non‑functions, include actual type.
|
|
24
|
+
- Ensure destructuring errors reference line/column and show expected vs received.
|
|
25
|
+
- Resolve any mismatch between parser tokens and interpreter operators.
|
|
26
|
+
- Clarify `async/await` semantics and ensure awaiting only actual promises.
|
|
27
|
+
- Ensure `break/continue` are only valid inside loops/switch.
|
|
28
|
+
- Ensure `return` is only valid inside functions.
|
|
29
|
+
|
|
30
|
+
## Phase 2 — Real Async Runtime (Core Gap vs Node.js)
|
|
31
|
+
- Replace all blocking I/O (`fs.readFileSync`, `execSync`, busy‑wait) with async equivalents.
|
|
32
|
+
- Introduce an event loop abstraction with a task queue and microtask queue.
|
|
33
|
+
- Implement timers (`setTimeout`, `setInterval`, `clearTimeout`, `clearInterval`).
|
|
34
|
+
- Implement promises that integrate with the runtime, not only JS promises.
|
|
35
|
+
- Implement async stack traces for awaited frames.
|
|
36
|
+
- Add cancellation support (AbortController‑like).
|
|
37
|
+
- Add async hooks to enable tracing and profiling.
|
|
38
|
+
|
|
39
|
+
## Phase 3 — Module System Parity
|
|
40
|
+
- Implement module caching with proper circular dependency handling.
|
|
41
|
+
- Add support for package `main` and `exports` in `vladx.json`.
|
|
42
|
+
- Add extension resolution rules that match Node’s behavior (configurable).
|
|
43
|
+
- Add module resolution for relative, absolute, and bare specifiers with clear errors.
|
|
44
|
+
- Add module type support (common vs esm‑like) or a single well‑defined model.
|
|
45
|
+
- Add a standardized module loader for builtin modules and stdlib.
|
|
46
|
+
|
|
47
|
+
## Phase 4 — Standard Library Modernization
|
|
48
|
+
- Split stdlib into a clean, stable core API with versioning.
|
|
49
|
+
- Replace `execSync` HTTP with a real HTTP client implementation.
|
|
50
|
+
- Provide a `fetch`‑like API and streaming responses.
|
|
51
|
+
- Provide filesystem async APIs with promises.
|
|
52
|
+
- Provide `net`, `tls`, `http`, `https`, `crypto`, `zlib` equivalents.
|
|
53
|
+
- Provide `path`, `os`, `process` equivalents with consistent naming.
|
|
54
|
+
- Provide robust JSON, URL, and Buffer APIs.
|
|
55
|
+
- Provide structured errors for stdlib failures.
|
|
56
|
+
|
|
57
|
+
## Phase 5 — Security Hardening
|
|
58
|
+
- Add a permission model for filesystem, network, and process execution.
|
|
59
|
+
- Sandbox `Sistema.esegui` or remove by default.
|
|
60
|
+
- Remove string‑built shell calls in stdlib.
|
|
61
|
+
- Add input validation utilities and safe SQL helpers.
|
|
62
|
+
- Add secure defaults for HTTP client and server.
|
|
63
|
+
- Add dependency signature verification in VladPM.
|
|
64
|
+
- Add audit tooling for known vulnerabilities.
|
|
65
|
+
|
|
66
|
+
## Phase 6 — Performance & Memory
|
|
67
|
+
- Add a bytecode compiler or IR to avoid deep AST walking.
|
|
68
|
+
- Add a proper GC strategy or integrate with a VM that provides one.
|
|
69
|
+
- Add incremental GC hooks for async workloads.
|
|
70
|
+
- Add profiling tools (CPU, memory, async task tracking).
|
|
71
|
+
- Add performance benchmarks for core runtime and stdlib.
|
|
72
|
+
- Add a caching strategy for parsed modules.
|
|
73
|
+
- Add fast path for numeric operations and tight loops.
|
|
74
|
+
|
|
75
|
+
## Phase 7 — Language Features for Parity
|
|
76
|
+
- Add default parameters, rest/spread, and destructuring improvements.
|
|
77
|
+
- Add `try/catch` with error types and stack traces.
|
|
78
|
+
- Add `finally` reliability guarantees with async.
|
|
79
|
+
- Add `switch` strict matching options.
|
|
80
|
+
- Add generators or iterators if in scope.
|
|
81
|
+
- Add `for..of` and iterable protocol.
|
|
82
|
+
- Add optional chaining and nullish coalescing everywhere.
|
|
83
|
+
- Add proper `this` and `super` behavior in classes.
|
|
84
|
+
- Add class fields and private fields if desired.
|
|
85
|
+
|
|
86
|
+
## Phase 8 — Tooling (Developer Experience)
|
|
87
|
+
- Add a debugger protocol and CLI debugger.
|
|
88
|
+
- Add source maps for accurate error locations.
|
|
89
|
+
- Add a test runner with snapshot support.
|
|
90
|
+
- Add formatter and linter with Italian syntax rules.
|
|
91
|
+
- Add language server (LSP) with autocomplete, go‑to‑definition, hover.
|
|
92
|
+
- Add REPL improvements: history, auto‑completion, top‑level await.
|
|
93
|
+
|
|
94
|
+
## Phase 9 — VladPM (Ecosystem)
|
|
95
|
+
- Add semantic version resolution.
|
|
96
|
+
- Add dependency tree lock correctness and integrity checks.
|
|
97
|
+
- Add package cache and offline install.
|
|
98
|
+
- Add `vladpm audit`.
|
|
99
|
+
- Add `vladpm doctor`.
|
|
100
|
+
- Add scoped packages and registry auth improvements.
|
|
101
|
+
- Add registry replication and fallback mirrors.
|
|
102
|
+
|
|
103
|
+
## Phase 10 — Docs and Community
|
|
104
|
+
- Full reference documentation for language and stdlib.
|
|
105
|
+
- Cookbook of patterns and migration guides.
|
|
106
|
+
- Examples for web servers, CLIs, data processing, and automation.
|
|
107
|
+
- Contribution guidelines, RFC process, and release process.
|
|
108
|
+
|
|
109
|
+
## Phase 11 — Compatibility Goals
|
|
110
|
+
- Define what “Node.js‑level” means in measurable terms.
|
|
111
|
+
- Publish performance targets vs Node for key workloads.
|
|
112
|
+
- Publish supported core APIs and their compatibility level.
|
|
113
|
+
- Add a compatibility test suite.
|
|
114
|
+
|
|
115
|
+
## Immediate Technical TODOs (from current codebase)
|
|
116
|
+
- Fix `Archivio.*` path resolution relative to script directory.
|
|
117
|
+
- Replace blocking `aspetta` busy‑wait with async sleep.
|
|
118
|
+
- Replace `Rete.chiama` and `ClientWeb` curl usage with native HTTP.
|
|
119
|
+
- Fix REPL `evaluate` call to pass the correct environment.
|
|
120
|
+
- Improve error messages to include token context in parser errors.
|
|
121
|
+
- Ensure `optional chaining` tokens parse correctly in member access and calls.
|
|
122
|
+
- Add module path normalization and caching for absolute paths.
|
|
123
|
+
|
|
124
|
+
## Risks to Track
|
|
125
|
+
- Node parity is a multi‑year effort without a VM or JIT.
|
|
126
|
+
- Security and dependency integrity become critical as adoption grows.
|
|
127
|
+
- Backward compatibility can slow progress without clear versioning.
|
|
128
|
+
|
|
129
|
+
## Suggested Execution Order
|
|
130
|
+
1. Baseline Hygiene
|
|
131
|
+
2. Correctness Fixes
|
|
132
|
+
3. Real Async Runtime
|
|
133
|
+
4. Module System Parity
|
|
134
|
+
5. Stdlib Modernization
|
|
135
|
+
6. Security Hardening
|
|
136
|
+
7. Performance & Memory
|
|
137
|
+
8. Tooling
|
|
138
|
+
9. VladPM Ecosystem
|
|
139
|
+
10. Docs and Community
|
|
140
|
+
11. Compatibility Targets
|
package/programs/1/index.vx
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
classe Persona {
|
|
2
|
+
funzione costruttore(nome, eta) {
|
|
3
|
+
questo.nome = nome;
|
|
4
|
+
questo.eta = eta;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
funzione saluta() {
|
|
8
|
+
stampa("Ciao, sono " + questo.nome + " e ho " + questo.eta + " anni");
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
variabile p1 = nuovo Persona("Mario", 25);
|
|
13
|
+
p1.saluta();
|
|
14
|
+
|
|
15
|
+
variabile p2 = nuovo Persona("Luigi", 30);
|
|
16
|
+
p2.saluta();
|
package/programs/main/index.vx
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
importa {log, errore} da "@std/Console";
|
|
2
|
+
classe Persona {
|
|
3
|
+
funzione costruttore(nome, eta) {
|
|
4
|
+
questo.nome = nome
|
|
5
|
+
questo.eta = eta
|
|
6
|
+
}
|
|
7
|
+
funzione eMaggiorenne() {
|
|
8
|
+
se(questo.eta >= 18) {
|
|
9
|
+
ritorna vero
|
|
10
|
+
} altrimenti {
|
|
11
|
+
ritorna falso
|
|
12
|
+
}
|
|
13
|
+
}
|
|
9
14
|
}
|
|
10
|
-
|
|
11
|
-
Archivio.
|
|
15
|
+
variabile nome = chiedi("Come ti chiami? ")
|
|
16
|
+
se(Archivio.esiste(`passports/${nome}.json`)) {
|
|
17
|
+
errore("GIA ESISTE, VATTENE!!")
|
|
18
|
+
} altrimenti {
|
|
19
|
+
variabile eta = chiedi("Quanti anni hai? ")
|
|
20
|
+
variabile persona = nuovo Persona(nome, eta)
|
|
21
|
+
se(persona.eMaggiorenne()) {
|
|
22
|
+
log("Sei maggiorenne")
|
|
23
|
+
} altrimenti {
|
|
24
|
+
log("Sei minorenne")
|
|
25
|
+
}
|
|
26
|
+
Archivio.scrivi(`passports/${nome}.json`, JSON.stringify(persona))
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"klass":{"name":"Persona","superclass":null,"constructor":{"type":"FunctionDeclaration","name":"costruttore","params":["nome","eta"],"body":{"type":"BlockStatement","body":[{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"ThisExpression"},"property":{"type":"Identifier","name":"nome"},"computed":false,"optional":false},"right":{"type":"Identifier","name":"nome"}}},{"type":"ExpressionStatement","expression":{"type":"AssignmentExpression","operator":"=","left":{"type":"MemberExpression","object":{"type":"ThisExpression"},"property":{"type":"Identifier","name":"eta"},"computed":false,"optional":false},"right":{"type":"Identifier","name":"eta"}}}]},"isAsync":false},"methods":{}},"fields":{}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"nome":"Tanya","eta":"70"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"nome":"Vlad","eta":"
|
|
1
|
+
{"nome":"Vlad","eta":"12"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"nome":"vlad","eta":"13"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Test Nuove Funzionalità VladX
|
|
2
|
+
|
|
3
|
+
stampa("--- TEST SCEGLI-CASO ---");
|
|
4
|
+
variabile colore = "verde";
|
|
5
|
+
scegli (colore) {
|
|
6
|
+
caso "rosso":
|
|
7
|
+
stampa("Alt!");
|
|
8
|
+
interrompi;
|
|
9
|
+
caso "verde":
|
|
10
|
+
stampa("Vai!");
|
|
11
|
+
interrompi;
|
|
12
|
+
predefinito:
|
|
13
|
+
stampa("Colore ignoto");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
stampa("\n--- TEST DESTRUTTURAZIONE ---");
|
|
17
|
+
variabile [a, b] = [10, 20];
|
|
18
|
+
stampa("a: " + a + ", b: " + b); // 10, 20
|
|
19
|
+
|
|
20
|
+
variabile { nome, eta } = { nome: "Vlad", eta: 25, citta: "Roma" };
|
|
21
|
+
stampa("Nome: " + nome + ", Eta: " + eta); // Vlad, 25
|
|
22
|
+
|
|
23
|
+
stampa("\n--- TEST OPERATORE TERNARIO ---");
|
|
24
|
+
variabile x = 10;
|
|
25
|
+
variabile risultato = x > 5 ? "Maggiore" : "Minore";
|
|
26
|
+
stampa("Risultato: " + risultato); // Maggiore
|
|
27
|
+
|
|
28
|
+
stampa("\n--- TEST NULLISH COALESCING ---");
|
|
29
|
+
variabile n = nullo;
|
|
30
|
+
variabile val = n ?? "Default";
|
|
31
|
+
stampa("Valore: " + val); // Default
|
|
32
|
+
|
|
33
|
+
stampa("\n--- TEST OPTIONAL CHAINING ---");
|
|
34
|
+
variabile utente = { info: { nome: "Luca" } };
|
|
35
|
+
stampa("Nome utente: " + utente?.info?.nome); // Luca
|
|
36
|
+
stampa("Cognome utente: " + (utente?.info?.cognome ?? "N/A")); // N/A
|
|
37
|
+
|
|
38
|
+
stampa("\n--- TEST METODI ARRAY ---");
|
|
39
|
+
variabile numeri = [1, 2, 3, 4, 5];
|
|
40
|
+
variabile raddoppiati = attendi numeri.mappa((n) => n * 2);
|
|
41
|
+
stampa("Raddoppiati: " + raddoppiati); // [2, 4, 6, 8, 10]
|
|
42
|
+
|
|
43
|
+
variabile pari = attendi numeri.filtra((n) => n % 2 == 0);
|
|
44
|
+
stampa("Pari: " + pari); // [2, 4]
|
|
45
|
+
|
|
46
|
+
stampa("\n--- TEST MATEMATICA ---");
|
|
47
|
+
stampa("PI: " + Matematica.piGreco);
|
|
48
|
+
stampa("Radice di 16: " + Matematica.radice(16));
|
|
49
|
+
stampa("Casuale (0-1): " + Matematica.casuale());
|
|
50
|
+
|
|
51
|
+
stampa("\n--- TEST TEMPO ---");
|
|
52
|
+
stampa("Data oggi: " + Tempo.data());
|
|
53
|
+
stampa("Ora attuale: " + Tempo.ora());
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Test Integrazione Standard Library VladX
|
|
2
|
+
|
|
3
|
+
importa { maiuscolo, slugify } da "@std/Testo";
|
|
4
|
+
importa { sha256, uuid } da "@std/Cripto";
|
|
5
|
+
importa { log, successo, avviso } da "@std/Console";
|
|
6
|
+
importa { data, ora } da "@std/Tempo"; // Modulo integrato precendente (ora anche in @std/Cronometro)
|
|
7
|
+
importa { media, somma } da "@std/Calcolo";
|
|
8
|
+
|
|
9
|
+
stampa("--- TEST @std/Testo ---");
|
|
10
|
+
stampa("Maiuscolo: " + maiuscolo("vladx"));
|
|
11
|
+
stampa("Slug: " + slugify("Questo è un test!"));
|
|
12
|
+
|
|
13
|
+
stampa("\n--- TEST @std/Cripto ---");
|
|
14
|
+
stampa("SHA256: " + sha256("segreto"));
|
|
15
|
+
stampa("UUID: " + uuid());
|
|
16
|
+
|
|
17
|
+
stampa("\n--- TEST @std/Calcolo ---");
|
|
18
|
+
variabile voti = [10, 8, 9, 7];
|
|
19
|
+
stampa("Media: " + media(voti));
|
|
20
|
+
stampa("Somma: " + somma(voti));
|
|
21
|
+
|
|
22
|
+
stampa("\n--- TEST @std/Console ---");
|
|
23
|
+
successo("Questo è un messaggio di successo!");
|
|
24
|
+
avviso("Attenzione: questo è un avviso.");
|
|
25
|
+
|
|
26
|
+
stampa("\n--- FINE TEST ---");
|