@devaloop/devalang 0.0.1-alpha.12 → 0.0.1-alpha.13
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/Cargo.toml +54 -53
- package/README.md +1 -14
- package/docs/CHANGELOG.md +26 -0
- package/docs/TODO.md +1 -1
- package/examples/index.deva +10 -13
- package/out-tsc/bin/devalang.exe +0 -0
- package/package.json +1 -1
- package/project-version.json +3 -3
- package/rust/cli/build.rs +25 -2
- package/rust/cli/check.rs +26 -3
- package/rust/cli/play.rs +1 -1
- package/rust/core/audio/engine.rs +126 -73
- package/rust/core/audio/interpreter/call.rs +72 -47
- package/rust/core/audio/interpreter/condition.rs +14 -12
- package/rust/core/audio/interpreter/driver.rs +84 -127
- package/rust/core/audio/interpreter/function.rs +21 -0
- package/rust/core/audio/interpreter/load.rs +1 -1
- package/rust/core/audio/interpreter/loop_.rs +24 -18
- package/rust/core/audio/interpreter/mod.rs +2 -1
- package/rust/core/audio/interpreter/sleep.rs +0 -6
- package/rust/core/audio/interpreter/spawn.rs +78 -60
- package/rust/core/audio/interpreter/trigger.rs +157 -70
- package/rust/core/audio/loader/trigger.rs +37 -4
- package/rust/core/audio/player.rs +20 -10
- package/rust/core/audio/renderer.rs +24 -25
- package/rust/core/debugger/mod.rs +2 -0
- package/rust/core/debugger/module.rs +47 -0
- package/rust/core/debugger/store.rs +25 -11
- package/rust/core/error/mod.rs +6 -0
- package/rust/core/lexer/handler/driver.rs +23 -1
- package/rust/core/lexer/handler/identifier.rs +1 -0
- package/rust/core/lexer/handler/mod.rs +1 -0
- package/rust/core/lexer/handler/parenthesis.rs +41 -0
- package/rust/core/lexer/token.rs +3 -0
- package/rust/core/parser/driver.rs +3 -1
- package/rust/core/parser/handler/dot.rs +64 -127
- package/rust/core/parser/handler/identifier/call.rs +69 -22
- package/rust/core/parser/handler/identifier/function.rs +92 -0
- package/rust/core/parser/handler/identifier/let_.rs +13 -19
- package/rust/core/parser/handler/identifier/mod.rs +1 -0
- package/rust/core/parser/handler/identifier/spawn.rs +74 -27
- package/rust/core/parser/statement.rs +16 -4
- package/rust/core/preprocessor/loader.rs +45 -29
- package/rust/core/preprocessor/module.rs +3 -1
- package/rust/core/preprocessor/processor.rs +26 -1
- package/rust/core/preprocessor/resolver/call.rs +61 -84
- package/rust/core/preprocessor/resolver/condition.rs +11 -6
- package/rust/core/preprocessor/resolver/driver.rs +52 -6
- package/rust/core/preprocessor/resolver/function.rs +78 -0
- package/rust/core/preprocessor/resolver/group.rs +43 -13
- package/rust/core/preprocessor/resolver/let_.rs +7 -10
- package/rust/core/preprocessor/resolver/mod.rs +2 -1
- package/rust/core/preprocessor/resolver/spawn.rs +64 -30
- package/rust/core/preprocessor/resolver/trigger.rs +7 -3
- package/rust/core/preprocessor/resolver/value.rs +10 -1
- package/rust/core/shared/value.rs +4 -1
- package/rust/core/store/function.rs +34 -0
- package/rust/core/store/global.rs +9 -10
- package/rust/core/store/mod.rs +2 -1
- package/rust/core/store/variable.rs +6 -0
- package/rust/lib.rs +10 -7
- package/rust/utils/mod.rs +45 -1
package/Cargo.toml
CHANGED
|
@@ -1,53 +1,54 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "devalang"
|
|
3
|
-
version = "0.0.1-alpha.
|
|
4
|
-
authors = ["Devaloop <contact@devaloop.com>"]
|
|
5
|
-
description = "Write music like code. Devalang is a domain-specific language (DSL) for sound designers and music hackers. Compose, automate, and control sound — in plain text."
|
|
6
|
-
license = "MIT"
|
|
7
|
-
repository = "https://github.com/devaloop-labs/devalang"
|
|
8
|
-
keywords = ["music", "dsl", "audio", "cli"]
|
|
9
|
-
categories = ["command-line-utilities", "development-tools", "parser-implementations"]
|
|
10
|
-
readme = "README.md"
|
|
11
|
-
homepage = "https://devalang.com"
|
|
12
|
-
documentation = "https://docs.devalang.com/"
|
|
13
|
-
license-file = "LICENSE"
|
|
14
|
-
edition = "2024"
|
|
15
|
-
|
|
16
|
-
[[bin]]
|
|
17
|
-
name = "devalang"
|
|
18
|
-
path = "rust/main.rs"
|
|
19
|
-
required-features = ["cli"]
|
|
20
|
-
|
|
21
|
-
[lib]
|
|
22
|
-
path = "rust/lib.rs"
|
|
23
|
-
crate-type = ["cdylib"]
|
|
24
|
-
|
|
25
|
-
[profile.release]
|
|
26
|
-
opt-level = "s"
|
|
27
|
-
|
|
28
|
-
[features]
|
|
29
|
-
default = ["cli"]
|
|
30
|
-
cli = ["crossterm", "indicatif", "inquire", "zip", "reqwest", "flate2", "tokio"]
|
|
31
|
-
|
|
32
|
-
[dependencies]
|
|
33
|
-
clap = { version = "4.5", features = ["derive"] }
|
|
34
|
-
serde = { version = "1.0", features = ["derive"] }
|
|
35
|
-
serde_json = "1.0"
|
|
36
|
-
rodio = "0.17"
|
|
37
|
-
hound = "3.4.0"
|
|
38
|
-
toml = "0.8"
|
|
39
|
-
notify = "6.1"
|
|
40
|
-
fs_extra = "1.3"
|
|
41
|
-
include_dir = "0.7"
|
|
42
|
-
wasm-bindgen = "0.2"
|
|
43
|
-
serde-wasm-bindgen = "0.4"
|
|
44
|
-
nom_locate = "4.0.0"
|
|
45
|
-
chrono = "0.4"
|
|
46
|
-
crossterm = { version = "0.27", optional = true }
|
|
47
|
-
indicatif = { version = "0.17", optional = true }
|
|
48
|
-
inquire = { version = "0.7.5", optional = true }
|
|
49
|
-
js-sys = "0.3"
|
|
50
|
-
reqwest = { version = "0.12.22", optional = true, features = ["json"] }
|
|
51
|
-
flate2 = { version = "1.0", optional = true }
|
|
52
|
-
tokio = { version = "1", features = ["full"], optional = true }
|
|
53
|
-
zip = { version = "4.3.0", optional = true }
|
|
1
|
+
[package]
|
|
2
|
+
name = "devalang"
|
|
3
|
+
version = "0.0.1-alpha.13"
|
|
4
|
+
authors = ["Devaloop <contact@devaloop.com>"]
|
|
5
|
+
description = "Write music like code. Devalang is a domain-specific language (DSL) for sound designers and music hackers. Compose, automate, and control sound — in plain text."
|
|
6
|
+
license = "MIT"
|
|
7
|
+
repository = "https://github.com/devaloop-labs/devalang"
|
|
8
|
+
keywords = ["music", "dsl", "audio", "cli"]
|
|
9
|
+
categories = ["command-line-utilities", "development-tools", "parser-implementations"]
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
homepage = "https://devalang.com"
|
|
12
|
+
documentation = "https://docs.devalang.com/"
|
|
13
|
+
license-file = "LICENSE"
|
|
14
|
+
edition = "2024"
|
|
15
|
+
|
|
16
|
+
[[bin]]
|
|
17
|
+
name = "devalang"
|
|
18
|
+
path = "rust/main.rs"
|
|
19
|
+
required-features = ["cli"]
|
|
20
|
+
|
|
21
|
+
[lib]
|
|
22
|
+
path = "rust/lib.rs"
|
|
23
|
+
crate-type = ["cdylib", "rlib"]
|
|
24
|
+
|
|
25
|
+
[profile.release]
|
|
26
|
+
opt-level = "s"
|
|
27
|
+
|
|
28
|
+
[features]
|
|
29
|
+
default = ["cli"]
|
|
30
|
+
cli = ["crossterm", "indicatif", "inquire", "zip", "reqwest", "flate2", "tokio"]
|
|
31
|
+
|
|
32
|
+
[dependencies]
|
|
33
|
+
clap = { version = "4.5", features = ["derive"] }
|
|
34
|
+
serde = { version = "1.0", features = ["derive"] }
|
|
35
|
+
serde_json = "1.0"
|
|
36
|
+
rodio = "0.17"
|
|
37
|
+
hound = "3.4.0"
|
|
38
|
+
toml = "0.8"
|
|
39
|
+
notify = "6.1"
|
|
40
|
+
fs_extra = "1.3"
|
|
41
|
+
include_dir = "0.7"
|
|
42
|
+
wasm-bindgen = "0.2"
|
|
43
|
+
serde-wasm-bindgen = "0.4"
|
|
44
|
+
nom_locate = "4.0.0"
|
|
45
|
+
chrono = "0.4"
|
|
46
|
+
crossterm = { version = "0.27", optional = true }
|
|
47
|
+
indicatif = { version = "0.17", optional = true }
|
|
48
|
+
inquire = { version = "0.7.5", optional = true }
|
|
49
|
+
js-sys = "0.3"
|
|
50
|
+
reqwest = { version = "0.12.22", optional = true, features = ["json"] }
|
|
51
|
+
flate2 = { version = "1.0", optional = true }
|
|
52
|
+
tokio = { version = "1", features = ["full"], optional = true }
|
|
53
|
+
zip = { version = "4.3.0", optional = true }
|
|
54
|
+
rayon = "1.10.0"
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Compose loops, control samples, render and play audio — all in clean, readable
|
|
|
27
27
|
|
|
28
28
|
From studio sketches to live sets, Devalang gives you rhythmic control — with the elegance of code.
|
|
29
29
|
|
|
30
|
-
> 🚧 **v0.0.1-alpha.
|
|
30
|
+
> 🚧 **v0.0.1-alpha.13 Notice** 🚧
|
|
31
31
|
>
|
|
32
32
|
> NEW: Devalang is available in your browser at [playground.devalang.com](https://playground.devalang.com) !
|
|
33
33
|
>
|
|
@@ -119,22 +119,9 @@ devalang play --repeat
|
|
|
119
119
|
|
|
120
120
|
### Please refer to the [online documentation](https://docs.devalang.com) for detailed information on syntax, features, and usage examples.
|
|
121
121
|
|
|
122
|
-
## 📜 Changelog Highlights
|
|
123
|
-
|
|
124
|
-
For a complete list of changes, see [docs/CHANGELOG.md](./docs/CHANGELOG.md)
|
|
125
|
-
|
|
126
|
-
- Implemented beat durations in `triggers` and `arrow_calls` statements
|
|
127
|
-
- Implemented `bank` resolver to resolve banks of sounds in the code
|
|
128
|
-
- Support for namespaced banks of sounds (e.g. `.808.myTrigger`)
|
|
129
|
-
- Implemented multiple commands for `bank` management
|
|
130
|
-
- `bank list`, `bank available`, `bank info <bank_name>`, `bank remove <bank_name>`, `bank update`, `bank update <bank_name>`
|
|
131
|
-
- Implemented `install` command to install banks of sounds
|
|
132
|
-
- `install bank <bank_name>`
|
|
133
|
-
|
|
134
122
|
## 🧯 Known issues
|
|
135
123
|
|
|
136
124
|
- No smart modules yet, all groups, variables, and samples must be explicitly imported where used
|
|
137
|
-
- No support yet for `pattern`, `function`, ... statements
|
|
138
125
|
- No support yet for cross-platform builds (Linux, macOS)
|
|
139
126
|
|
|
140
127
|
## 🧪 Roadmap Highlights
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
# Changelog
|
|
6
6
|
|
|
7
|
+
## Version 0.0.1-alpha.13 (2025-07-26)
|
|
8
|
+
|
|
9
|
+
### 🧩 Language Features
|
|
10
|
+
|
|
11
|
+
- Added support for `fn` directive to define functions in Devalang.
|
|
12
|
+
- Example: `fn myFunction(param1, param2):`
|
|
13
|
+
|
|
14
|
+
### 🧠 Core Engine
|
|
15
|
+
|
|
16
|
+
- Patched `trigger`, `call`, and `spawn`, `renderer` to handle correct cursor time in the audio interpreter.
|
|
17
|
+
- Refactored audio engine and interpreter to handle correct timing and execution while using `loop`, `call`, and `spawn` statements.
|
|
18
|
+
- Refactored `trigger` effects to apply more effects to triggers.
|
|
19
|
+
- Example: `.myTrigger auto { reverb: 0.25, pitch: 0.75, gain: 0.8 }`
|
|
20
|
+
- Refactored `preprocessor` to handle correct namespaced banks of sounds and triggers.
|
|
21
|
+
- Refactored `collect_errors_recursively` to provide detailed error reporting across nested statements.
|
|
22
|
+
- Optimized the `renderer` to handle silent buffers and improve performance.
|
|
23
|
+
|
|
24
|
+
### 🛠️ Utilities
|
|
25
|
+
|
|
26
|
+
- Added the `extract_loop_body_statements` utility for better loop handling.
|
|
27
|
+
- Improved logging for module variables and functions.
|
|
28
|
+
|
|
29
|
+
### 🧩 Web Assembly
|
|
30
|
+
|
|
31
|
+
- Patched `lib.rs` dependencies to ensure compatibility with the latest Rust and WASM standards.
|
|
32
|
+
|
|
7
33
|
## Version 0.0.1-alpha.12 (2025-07-21)
|
|
8
34
|
|
|
9
35
|
### 🧩 Language Features
|
package/docs/TODO.md
CHANGED
package/examples/index.deva
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
# This file demonstrates the use of main features in Devalang.
|
|
2
|
+
bpm 135
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
@import { myLead } from "./synth.deva"
|
|
5
|
-
@import { myLoop } from "./loop.deva"
|
|
4
|
+
bank 808
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
let entityTest1 = .808.kick auto
|
|
7
|
+
let entityTest2 = .808.clap auto
|
|
8
|
+
let entityTest3 = .808.snare auto
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
fn myFirstGroup(entity1, entity2, entity3):
|
|
11
|
+
.entity1
|
|
12
|
+
.entity2
|
|
13
|
+
.entity3
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
# spawn myLoop
|
|
14
|
-
# spawn myLead
|
|
15
|
-
|
|
16
|
-
# call myTrack
|
|
17
|
-
|
|
18
|
-
.kickCustom duration { gain: 1, pitch: 1.25 }
|
|
15
|
+
call myFirstGroup(entityTest1, entityTest2, entityTest3)
|
package/out-tsc/bin/devalang.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devaloop/devalang",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.1-alpha.
|
|
4
|
+
"version": "0.0.1-alpha.13",
|
|
5
5
|
"description": "Write music like code. Devalang is a domain-specific language (DSL) for sound designers and music hackers. Compose, automate, and control sound — in plain text.",
|
|
6
6
|
"main": "out-tsc/index.js",
|
|
7
7
|
"bin": {
|
package/project-version.json
CHANGED
package/rust/cli/build.rs
CHANGED
|
@@ -4,8 +4,9 @@ use crate::{
|
|
|
4
4
|
builder::Builder,
|
|
5
5
|
debugger::{
|
|
6
6
|
lexer::write_lexer_log_file,
|
|
7
|
+
module::{ write_module_function_log_file, write_module_variable_log_file },
|
|
7
8
|
preprocessor::write_preprocessor_log_file,
|
|
8
|
-
store::
|
|
9
|
+
store::{ write_function_log_file, write_variables_log_file },
|
|
9
10
|
},
|
|
10
11
|
preprocessor::loader::ModuleLoader,
|
|
11
12
|
store::global::GlobalStore,
|
|
@@ -111,13 +112,35 @@ fn begin_build(entry: String, output: String) {
|
|
|
111
112
|
let (modules_tokens, modules_statements) = module_loader.load_all_modules(&mut global_store);
|
|
112
113
|
|
|
113
114
|
// SECTION Write logs
|
|
115
|
+
for (module_path, module) in global_store.modules.clone() {
|
|
116
|
+
write_module_variable_log_file(
|
|
117
|
+
&normalized_output_dir,
|
|
118
|
+
&module_path,
|
|
119
|
+
&module.variable_table
|
|
120
|
+
);
|
|
121
|
+
write_module_function_log_file(
|
|
122
|
+
&normalized_output_dir,
|
|
123
|
+
&module_path,
|
|
124
|
+
&module.function_table
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
114
128
|
write_lexer_log_file(&normalized_output_dir, "lexer_tokens.log", modules_tokens.clone());
|
|
115
129
|
write_preprocessor_log_file(
|
|
116
130
|
&normalized_output_dir,
|
|
117
131
|
"resolved_statements.log",
|
|
118
132
|
modules_statements.clone()
|
|
119
133
|
);
|
|
120
|
-
|
|
134
|
+
write_variables_log_file(
|
|
135
|
+
&normalized_output_dir,
|
|
136
|
+
"global_variables.log",
|
|
137
|
+
global_store.variables.clone()
|
|
138
|
+
);
|
|
139
|
+
write_function_log_file(
|
|
140
|
+
&normalized_output_dir,
|
|
141
|
+
"global_functions.log",
|
|
142
|
+
global_store.functions.clone()
|
|
143
|
+
);
|
|
121
144
|
|
|
122
145
|
// SECTION Building AST and Audio
|
|
123
146
|
let builder = Builder::new();
|
package/rust/cli/check.rs
CHANGED
|
@@ -5,7 +5,12 @@ use crate::{
|
|
|
5
5
|
store::global::GlobalStore,
|
|
6
6
|
utils::path::{ find_entry_file, normalize_path },
|
|
7
7
|
},
|
|
8
|
-
utils::{
|
|
8
|
+
utils::{
|
|
9
|
+
collect_errors_recursively,
|
|
10
|
+
logger::{ LogLevel, Logger },
|
|
11
|
+
spinner::with_spinner,
|
|
12
|
+
watcher::watch_directory,
|
|
13
|
+
},
|
|
9
14
|
};
|
|
10
15
|
use std::{ thread, time::Duration };
|
|
11
16
|
|
|
@@ -104,7 +109,26 @@ fn begin_check(entry: String, output: String) {
|
|
|
104
109
|
// NOTE: We don't use modules in the check command, but we still need to load them
|
|
105
110
|
let modules = module_loader.load_all_modules(&mut global_store);
|
|
106
111
|
|
|
107
|
-
//
|
|
112
|
+
// Debugging: Log loaded modules and errors
|
|
113
|
+
let logger = Logger::new();
|
|
114
|
+
logger.log_message(LogLevel::Info, "Loaded modules:");
|
|
115
|
+
for (module_name, _) in &modules.0 {
|
|
116
|
+
logger.log_message(LogLevel::Info, &format!("- {}", module_name));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
let mut all_errors = Vec::new();
|
|
120
|
+
for (_, statements) in &modules.1 {
|
|
121
|
+
all_errors.extend(collect_errors_recursively(statements));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if !all_errors.is_empty() {
|
|
125
|
+
logger.log_message(LogLevel::Error, "Errors detected during check:");
|
|
126
|
+
for error in all_errors {
|
|
127
|
+
logger.log_message(LogLevel::Error, &format!("- {}", error.message));
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
logger.log_message(LogLevel::Success, "No errors detected.");
|
|
131
|
+
}
|
|
108
132
|
|
|
109
133
|
let success_message = format!(
|
|
110
134
|
"Check completed successfully in {:.2?}. Output files written to: '{}'",
|
|
@@ -112,6 +136,5 @@ fn begin_check(entry: String, output: String) {
|
|
|
112
136
|
normalized_output_dir
|
|
113
137
|
);
|
|
114
138
|
|
|
115
|
-
let logger = Logger::new();
|
|
116
139
|
logger.log_message(LogLevel::Success, &success_message);
|
|
117
140
|
}
|
package/rust/cli/play.rs
CHANGED