@devaloop/devalang 0.0.1-alpha.1 → 0.0.1-alpha.3

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.
Files changed (105) hide show
  1. package/.devalang +4 -0
  2. package/Cargo.toml +46 -45
  3. package/README.md +35 -10
  4. package/docs/CHANGELOG.md +58 -0
  5. package/docs/COMMANDS.md +29 -6
  6. package/docs/CONFIG.md +28 -0
  7. package/docs/ROADMAP.md +6 -2
  8. package/docs/TODO.md +21 -18
  9. package/examples/exported.deva +1 -1
  10. package/examples/index.deva +2 -1
  11. package/out-tsc/bin/devalang.exe +0 -0
  12. package/package.json +2 -3
  13. package/project-version.json +4 -4
  14. package/rust/cli/build.rs +99 -29
  15. package/rust/cli/check.rs +95 -103
  16. package/rust/cli/init.rs +77 -0
  17. package/rust/cli/mod.rs +174 -1
  18. package/rust/cli/template.rs +56 -0
  19. package/rust/config/loader.rs +14 -0
  20. package/rust/config/mod.rs +15 -0
  21. package/rust/core/builder/mod.rs +21 -27
  22. package/rust/core/debugger/lexer.rs +12 -0
  23. package/rust/core/debugger/mod.rs +12 -49
  24. package/rust/core/debugger/preprocessor.rs +23 -0
  25. package/rust/core/error/mod.rs +60 -0
  26. package/rust/core/lexer/handler/at.rs +21 -0
  27. package/rust/core/lexer/handler/brace.rs +41 -0
  28. package/rust/core/lexer/handler/colon.rs +21 -0
  29. package/rust/core/lexer/handler/comment.rs +30 -0
  30. package/rust/core/lexer/handler/dot.rs +21 -0
  31. package/rust/core/lexer/handler/equal.rs +32 -0
  32. package/rust/core/lexer/handler/identifier.rs +38 -0
  33. package/rust/core/lexer/handler/indent.rs +52 -0
  34. package/rust/core/lexer/handler/mod.rs +238 -0
  35. package/rust/core/lexer/handler/newline.rs +19 -0
  36. package/rust/core/lexer/handler/number.rs +31 -0
  37. package/rust/core/lexer/handler/string.rs +66 -0
  38. package/rust/core/lexer/mod.rs +16 -324
  39. package/rust/core/lexer/token.rs +55 -0
  40. package/rust/core/mod.rs +5 -2
  41. package/rust/core/parser/handler/at.rs +166 -0
  42. package/rust/core/parser/handler/bank.rs +38 -0
  43. package/rust/core/parser/handler/dot.rs +112 -0
  44. package/rust/core/parser/handler/identifier.rs +134 -0
  45. package/rust/core/parser/handler/loop_.rs +55 -0
  46. package/rust/core/parser/handler/mod.rs +6 -0
  47. package/rust/core/parser/handler/tempo.rs +47 -0
  48. package/rust/core/parser/mod.rs +204 -166
  49. package/rust/core/parser/statement.rs +91 -0
  50. package/rust/core/preprocessor/loader.rs +105 -0
  51. package/rust/core/preprocessor/mod.rs +2 -24
  52. package/rust/core/preprocessor/module.rs +37 -56
  53. package/rust/core/preprocessor/processor.rs +41 -0
  54. package/rust/core/preprocessor/resolver.rs +372 -0
  55. package/rust/core/shared/duration.rs +8 -0
  56. package/rust/core/shared/mod.rs +2 -0
  57. package/rust/core/shared/value.rs +18 -0
  58. package/rust/core/store/export.rs +28 -0
  59. package/rust/core/store/global.rs +39 -0
  60. package/rust/core/store/import.rs +28 -0
  61. package/rust/core/store/mod.rs +4 -0
  62. package/rust/core/store/variable.rs +28 -0
  63. package/rust/core/utils/mod.rs +2 -0
  64. package/rust/core/utils/validation.rs +35 -0
  65. package/rust/lib.rs +0 -1
  66. package/rust/main.rs +39 -30
  67. package/rust/utils/file.rs +35 -0
  68. package/rust/utils/logger.rs +69 -34
  69. package/rust/utils/mod.rs +3 -2
  70. package/rust/utils/watcher.rs +25 -0
  71. package/templates/minimal/.devalang +4 -0
  72. package/templates/minimal/src/index.deva +2 -0
  73. package/templates/welcome/.devalang +4 -0
  74. package/templates/welcome/README.md +185 -0
  75. package/templates/welcome/samples/kick-808.wav +0 -0
  76. package/templates/welcome/src/index.deva +13 -0
  77. package/templates/welcome/src/variables.deva +5 -0
  78. package/rust/audio/mod.rs +0 -1
  79. package/rust/cli/new.rs +0 -1
  80. package/rust/core/parser/at.rs +0 -142
  81. package/rust/core/parser/bank.rs +0 -42
  82. package/rust/core/parser/dot.rs +0 -107
  83. package/rust/core/parser/identifer.rs +0 -91
  84. package/rust/core/parser/loop_.rs +0 -62
  85. package/rust/core/parser/tempo.rs +0 -42
  86. package/rust/core/parser/variable.rs +0 -129
  87. package/rust/core/preprocessor/dependencies.rs +0 -54
  88. package/rust/core/preprocessor/resolver/at.rs +0 -24
  89. package/rust/core/preprocessor/resolver/bank.rs +0 -59
  90. package/rust/core/preprocessor/resolver/loop_.rs +0 -82
  91. package/rust/core/preprocessor/resolver/mod.rs +0 -113
  92. package/rust/core/preprocessor/resolver/tempo.rs +0 -70
  93. package/rust/core/preprocessor/resolver/trigger.rs +0 -176
  94. package/rust/core/types/cli.rs +0 -160
  95. package/rust/core/types/mod.rs +0 -7
  96. package/rust/core/types/module.rs +0 -41
  97. package/rust/core/types/parser.rs +0 -73
  98. package/rust/core/types/statement.rs +0 -105
  99. package/rust/core/types/store.rs +0 -116
  100. package/rust/core/types/token.rs +0 -83
  101. package/rust/core/types/variable.rs +0 -32
  102. package/rust/runner/executer.rs +0 -44
  103. package/rust/runner/mod.rs +0 -1
  104. /package/rust/{utils → core/utils}/path.rs +0 -0
  105. /package/rust/utils/{loader.rs → spinner.rs} +0 -0
@@ -1,59 +0,0 @@
1
- use crate::core::{parser::parse_with_resolving_with_module, types::{
2
- module::Module,
3
- statement::{ Statement, StatementKind, StatementResolved, StatementResolvedValue },
4
- variable::VariableValue,
5
- }};
6
-
7
- pub fn resolve_bank_statement(stmt: &Statement, module: &Module) -> StatementResolved {
8
- match &stmt.value {
9
- VariableValue::Text(name) => {
10
- if
11
- let Some(value) = module.import_table.imports
12
- .get(name)
13
- .or_else(|| module.variable_table.variables.get(name))
14
- {
15
- let statement_value: StatementResolvedValue = match value {
16
- VariableValue::Array(arr) => {
17
- StatementResolvedValue::Array(
18
- parse_with_resolving_with_module(arr.clone(), module)
19
- )
20
- }
21
- VariableValue::Text(text) => StatementResolvedValue::String(text.clone()),
22
- VariableValue::Number(num) => StatementResolvedValue::Number(*num),
23
- VariableValue::Boolean(b) => StatementResolvedValue::Boolean(*b),
24
- _ => {
25
- eprintln!("⚠️ Unsupported variable type for Bank: {:?}", value);
26
- StatementResolvedValue::Unknown
27
- }
28
- };
29
-
30
- StatementResolved {
31
- kind: StatementKind::Bank,
32
- value: statement_value,
33
- indent: stmt.indent,
34
- line: stmt.line,
35
- column: stmt.column,
36
- }
37
- } else {
38
- eprintln!("⚠️ Bank variable '{}' not found", name);
39
- StatementResolved {
40
- kind: StatementKind::Bank,
41
- value: StatementResolvedValue::Unknown,
42
- indent: stmt.indent,
43
- line: stmt.line,
44
- column: stmt.column,
45
- }
46
- }
47
- }
48
- _ => {
49
- eprintln!("⚠️ Invalid value type for Bank statement: {:?}", stmt.value);
50
- StatementResolved {
51
- kind: StatementKind::Bank,
52
- value: StatementResolvedValue::Unknown,
53
- indent: stmt.indent,
54
- line: stmt.line,
55
- column: stmt.column,
56
- }
57
- }
58
- }
59
- }
@@ -1,82 +0,0 @@
1
- use crate::core::{
2
- parser::parse_without_resolving_with_module,
3
- preprocessor::resolver::resolve_statement,
4
- types::{
5
- module::Module,
6
- statement::{
7
- Statement,
8
- StatementIterator,
9
- StatementKind,
10
- StatementResolved,
11
- StatementResolvedValue,
12
- },
13
- variable::VariableValue,
14
- },
15
- };
16
-
17
- pub fn resolve_loop_statement(
18
- loop_statement: &Statement,
19
- iterator: StatementIterator,
20
- module: &Module
21
- ) -> StatementResolved {
22
- let mut resolved_iterator = StatementIterator::Unknown;
23
-
24
- match iterator.clone() {
25
- StatementIterator::Identifier(id) => {
26
- if let Some(value) = module.variable_table.variables.get(&id) {
27
- match value {
28
- VariableValue::Array(arr) => {
29
- resolved_iterator = StatementIterator::Array(
30
- parse_without_resolving_with_module(arr.clone(), module)
31
- );
32
- }
33
- VariableValue::Number(num) => {
34
- resolved_iterator = StatementIterator::Number(*num);
35
- }
36
- _ => {
37
- eprintln!("⚠️ Unsupported variable type for loop iterator: {:?}", value);
38
- resolved_iterator = StatementIterator::Unknown;
39
- }
40
- }
41
- } else {
42
- eprintln!("⚠️ Loop iterator variable '{}' not found", id);
43
- resolved_iterator = StatementIterator::Unknown;
44
- }
45
- }
46
- StatementIterator::Number(num) => {
47
- resolved_iterator = StatementIterator::Number(num);
48
- }
49
- _ => {
50
- resolved_iterator = iterator.clone();
51
- }
52
- }
53
-
54
- let mut resolved_body: StatementResolvedValue = StatementResolvedValue::Unknown;
55
-
56
- match &loop_statement.value {
57
- VariableValue::Array(arr) => {
58
- let raw_statements = parse_without_resolving_with_module(arr.clone(), &module.clone());
59
-
60
- let mut resolved_statements = Vec::new();
61
-
62
- for raw_stmt in raw_statements {
63
- let resolved_stmt = resolve_statement(&raw_stmt, &mut module.clone());
64
- resolved_statements.push(resolved_stmt);
65
- }
66
-
67
- resolved_body = StatementResolvedValue::Array(resolved_statements);
68
- }
69
- _ => {
70
- resolved_body = StatementResolvedValue::Unknown;
71
- eprintln!("⚠️ Unsupported value type for loop body: {:?}", loop_statement.value);
72
- }
73
- }
74
-
75
- return StatementResolved {
76
- kind: StatementKind::Loop { iterator: resolved_iterator },
77
- value: resolved_body,
78
- indent: loop_statement.indent,
79
- line: loop_statement.line,
80
- column: loop_statement.column,
81
- };
82
- }
@@ -1,113 +0,0 @@
1
- pub mod bank;
2
- pub mod loop_;
3
- pub mod tempo;
4
- pub mod trigger;
5
- pub mod at;
6
-
7
- use crate::core::{
8
- preprocessor::resolver::{
9
- bank::resolve_bank_statement,
10
- loop_::resolve_loop_statement,
11
- tempo::resolve_tempo_statement,
12
- trigger::resolve_trigger_statement,
13
- at::{ resolve_load_statement },
14
- },
15
- types::{
16
- module::Module,
17
- parser::Parser,
18
- statement::{ Statement, StatementKind, StatementResolved, StatementResolvedValue },
19
- store::{ ExportTable, GlobalStore, ImportTable },
20
- variable::VariableValue,
21
- },
22
- };
23
-
24
- pub fn resolve_exports(statements: &[Statement], parser: &Parser) -> ExportTable {
25
- let mut export_table = parser.export_table.clone();
26
-
27
- for stmt in statements {
28
- if let StatementKind::Export = &stmt.kind {
29
- if let VariableValue::Array(tokens) = &stmt.value {
30
- for token in tokens {
31
- let var_name = &token.lexeme;
32
- if let Some(value) = parser.variable_table.variables.get(var_name) {
33
- export_table.add_export(var_name.clone(), value.clone());
34
- } else {
35
- eprintln!("⚠️ Variable '{}' not found in scope, export skipped", var_name);
36
- }
37
- }
38
- } else {
39
- eprintln!("⚠️ Unexpected value type in export: {:?}", stmt.value);
40
- }
41
- }
42
- }
43
-
44
- export_table
45
- }
46
-
47
- pub fn resolve_imports(module: &mut Module, global_store: &GlobalStore) -> ImportTable {
48
- let mut import_table = ImportTable::default();
49
-
50
- for stmt in &module.statements {
51
- if let StatementKind::Import { names, source } = &stmt.kind {
52
- if let Some(from_module) = global_store.modules.get(source) {
53
- for name in names {
54
- if let Some(value) = from_module.export_table.exports.get(name) {
55
- module.variable_table.variables.insert(name.clone(), value.clone());
56
- import_table.add_import(name.clone(), value.clone());
57
- } else {
58
- eprintln!("⚠️ '{}' not found in exports of '{}'", name, source);
59
- }
60
- }
61
- } else {
62
- eprintln!("⚠️ Module '{}' not found", source);
63
- }
64
- }
65
- }
66
-
67
- import_table
68
- }
69
-
70
- pub fn resolve_statement(stmt: &Statement, module: &mut Module) -> StatementResolved {
71
- match &stmt.kind {
72
- StatementKind::Loop { iterator } => {
73
- resolve_loop_statement(stmt, iterator.clone(), module)
74
- }
75
-
76
- StatementKind::Trigger { entity, duration } => {
77
- resolve_trigger_statement(stmt, entity.clone(), duration.clone(), module)
78
- }
79
-
80
- StatementKind::Bank { .. } => { resolve_bank_statement(stmt, module) }
81
-
82
- StatementKind::Tempo { .. } => { resolve_tempo_statement(stmt, module) }
83
-
84
- StatementKind::Load { source, alias } => {
85
- resolve_load_statement(stmt, source, alias, module)
86
- }
87
-
88
- // TODO Handle other statement kinds
89
-
90
- StatementKind::Error => {
91
- StatementResolved {
92
- kind: StatementKind::Error,
93
- value: match stmt.value {
94
- VariableValue::Text(ref msg) => StatementResolvedValue::String(msg.clone()),
95
- _ => StatementResolvedValue::Unknown,
96
- },
97
- indent: stmt.indent,
98
- line: stmt.line,
99
- column: stmt.column,
100
- }
101
- }
102
-
103
- _ => {
104
- StatementResolved {
105
- kind: StatementKind::Unknown,
106
- value: StatementResolvedValue::Unknown,
107
- indent: stmt.indent,
108
- line: stmt.line,
109
- column: stmt.column,
110
- }
111
- }
112
- }
113
- }
@@ -1,70 +0,0 @@
1
- use crate::core::types::{module::Module, statement::{Statement, StatementKind, StatementResolved, StatementResolvedValue}, variable::VariableValue};
2
-
3
- pub fn resolve_tempo_statement(
4
- tempo_statement: &Statement,
5
- module: &Module
6
- ) -> StatementResolved {
7
- match &tempo_statement.value {
8
- VariableValue::Number(num) => {
9
- if *num > 0.0 {
10
- StatementResolved {
11
- kind: StatementKind::Tempo,
12
- value: StatementResolvedValue::Number(*num),
13
- indent: tempo_statement.indent,
14
- line: tempo_statement.line,
15
- column: tempo_statement.column,
16
- }
17
- } else {
18
- eprintln!("⚠️ Invalid tempo value: {}", num);
19
- StatementResolved {
20
- kind: StatementKind::Tempo,
21
- value: StatementResolvedValue::Unknown,
22
- indent: tempo_statement.indent,
23
- line: tempo_statement.line,
24
- column: tempo_statement.column,
25
- }
26
- }
27
- }
28
- VariableValue::Text(text) => {
29
- if let Some(value) = module.variable_table.variables.get(text) {
30
- let variable_value: StatementResolvedValue = match value {
31
- VariableValue::Number(num) if *num > 0.0 => {
32
- StatementResolvedValue::Number(*num)
33
- }
34
- VariableValue::Text(t) => StatementResolvedValue::String(t.clone()),
35
- _ => {
36
- eprintln!("⚠️ Unsupported variable type for Tempo: {:?}", value);
37
- StatementResolvedValue::Unknown
38
- }
39
- };
40
-
41
- StatementResolved {
42
- kind: StatementKind::Tempo,
43
- value: variable_value,
44
- indent: tempo_statement.indent,
45
- line: tempo_statement.line,
46
- column: tempo_statement.column,
47
- }
48
- } else {
49
- eprintln!("⚠️ Tempo variable '{}' not found", text);
50
- StatementResolved {
51
- kind: StatementKind::Tempo,
52
- value: StatementResolvedValue::Unknown,
53
- indent: tempo_statement.indent,
54
- line: tempo_statement.line,
55
- column: tempo_statement.column,
56
- }
57
- }
58
- }
59
- _ => {
60
- eprintln!("⚠️ Invalid value type for Tempo statement: {:?}", tempo_statement.value);
61
- StatementResolved {
62
- kind: StatementKind::Tempo,
63
- value: StatementResolvedValue::Unknown,
64
- indent: tempo_statement.indent,
65
- line: tempo_statement.line,
66
- column: tempo_statement.column,
67
- }
68
- }
69
- }
70
- }
@@ -1,176 +0,0 @@
1
- use std::collections::HashMap;
2
-
3
- use crate::core::{
4
- parser::parse_with_resolving_with_module,
5
- types::{
6
- module::Module,
7
- statement::{ Statement, StatementKind, StatementResolved, StatementResolvedValue },
8
- token::{ TokenDuration, TokenParamValue },
9
- variable::VariableValue,
10
- },
11
- };
12
-
13
- pub fn resolve_trigger_statement(
14
- stmt: &Statement,
15
- entity: String,
16
- duration: TokenDuration,
17
- module: &Module
18
- ) -> StatementResolved {
19
- let mut entity_value = VariableValue::Unknown;
20
-
21
- if let Some(value) = module.variable_table.variables.get(&entity) {
22
- entity_value = value.clone();
23
- } else {
24
- entity_value = VariableValue::Text(entity.clone());
25
- }
26
-
27
- let duration_raw_value = match duration {
28
- TokenDuration::Auto => "auto",
29
- TokenDuration::Infinite => "infinite",
30
- TokenDuration::Number(n) => &n.to_string(),
31
- TokenDuration::Identifier(ref id) => id.as_str(),
32
- _ => "unknown",
33
- };
34
-
35
- let duration_variable_value = module.variable_table.variables.get(duration_raw_value);
36
- let mut parsed_duration_value = TokenDuration::Unknown;
37
-
38
- if duration_variable_value.is_some() {
39
- parsed_duration_value = duration_variable_value
40
- .as_ref()
41
- .map_or(TokenDuration::Unknown, |value| {
42
- match value {
43
- VariableValue::Text(text) => TokenDuration::Identifier(text.clone()),
44
- VariableValue::Number(num) => TokenDuration::Number(*num),
45
- VariableValue::Boolean(_) => TokenDuration::Unknown,
46
- _ => {
47
- eprintln!("⚠️ Invalid duration type for Trigger: {:?}", value);
48
- TokenDuration::Unknown
49
- }
50
- }
51
- });
52
- } else if let Ok(num) = duration_raw_value.parse::<f32>() {
53
- parsed_duration_value = TokenDuration::Number(num);
54
- } else if duration_raw_value == "auto" {
55
- parsed_duration_value = TokenDuration::Auto;
56
- } else if duration_raw_value == "infinite" {
57
- parsed_duration_value = TokenDuration::Infinite;
58
- } else {
59
- eprintln!("⚠️ Invalid duration format: {}", duration_raw_value);
60
- }
61
-
62
- match &stmt.value {
63
- VariableValue::Text(text) => {
64
- if let Some(value) = module.variable_table.variables.get(text) {
65
- let parsed_entity_value: StatementResolvedValue = match value {
66
- VariableValue::Array(arr) => {
67
- StatementResolvedValue::Array(
68
- parse_with_resolving_with_module(arr.clone(), module)
69
- )
70
- }
71
- VariableValue::Map(map) => {
72
- let mut resolved_map = HashMap::new();
73
-
74
- for (key, value) in map {
75
- let resolved_value = match value {
76
- TokenParamValue::String(text) =>
77
- StatementResolvedValue::String(text.clone()),
78
- TokenParamValue::Number(num) =>
79
- StatementResolvedValue::Number(*num),
80
- TokenParamValue::Boolean(b) => StatementResolvedValue::Boolean(*b),
81
- _ => {
82
- eprintln!(
83
- "⚠️ Unsupported variable type for Trigger map: {:?}",
84
- value
85
- );
86
- StatementResolvedValue::Unknown
87
- }
88
- };
89
- resolved_map.insert(key.clone(), resolved_value);
90
- }
91
-
92
- StatementResolvedValue::Map(resolved_map)
93
- }
94
-
95
- | VariableValue::Text(_)
96
- | VariableValue::Number(_)
97
- | VariableValue::Boolean(_) => {
98
- StatementResolvedValue::String(text.clone())
99
- }
100
- _ => {
101
- eprintln!("⚠️ Unsupported variable type for Trigger entity: {:?}", value);
102
- StatementResolvedValue::Unknown
103
- }
104
- };
105
-
106
- StatementResolved {
107
- kind: StatementKind::Trigger {
108
- entity: entity.clone(),
109
- duration: parsed_duration_value,
110
- },
111
- value: parsed_entity_value,
112
- indent: stmt.indent,
113
- line: stmt.line,
114
- column: stmt.column,
115
- }
116
- } else {
117
- eprintln!("⚠️ Trigger variable '{}' not found", text);
118
- StatementResolved {
119
- kind: StatementKind::Trigger {
120
- entity: entity.clone(),
121
- duration: parsed_duration_value,
122
- },
123
- value: StatementResolvedValue::Unknown,
124
- indent: stmt.indent,
125
- line: stmt.line,
126
- column: stmt.column,
127
- }
128
- }
129
- }
130
- VariableValue::Map(map) => {
131
- let mut resolved_map = HashMap::new();
132
-
133
- // TODO Handle nested maps and arrays
134
-
135
- StatementResolved {
136
- kind: StatementKind::Trigger {
137
- entity: entity.clone(),
138
- duration: parsed_duration_value,
139
- },
140
- value: StatementResolvedValue::Map(resolved_map),
141
- indent: stmt.indent,
142
- line: stmt.line,
143
- column: stmt.column,
144
- }
145
- }
146
- VariableValue::Null => {
147
- StatementResolved {
148
- kind: StatementKind::Trigger {
149
- entity: entity.clone(),
150
- duration: parsed_duration_value,
151
- },
152
- value: StatementResolvedValue::Map(HashMap::new()),
153
- indent: stmt.indent,
154
- line: stmt.line,
155
- column: stmt.column,
156
- }
157
- }
158
-
159
- // TODO Parse other parameters
160
-
161
- _ => {
162
- eprintln!("⚠️ Invalid value type for Trigger statement: {:?}", stmt.value);
163
-
164
- StatementResolved {
165
- kind: StatementKind::Trigger {
166
- entity: entity.clone(),
167
- duration: parsed_duration_value,
168
- },
169
- value: StatementResolvedValue::Unknown,
170
- indent: stmt.indent,
171
- line: stmt.line,
172
- column: stmt.column,
173
- }
174
- }
175
- }
176
- }
@@ -1,160 +0,0 @@
1
- use clap::{ Parser, Subcommand };
2
- use crate::utils::version::get_version;
3
-
4
- #[derive(Parser)]
5
- #[command(name = "devalang")]
6
- #[command(author = "Devaloop")]
7
- #[command(version = get_version())]
8
- #[command(about = "🦊 Devalang – A programming language for music and sound.")]
9
- pub struct Cli {
10
- #[command(subcommand)]
11
- pub command: CliCommands,
12
- }
13
-
14
- #[derive(Subcommand)]
15
- pub enum CliTemplateCommand {
16
- /// Lists all available templates for Devalang projects.
17
- List,
18
- /// Displays information about a specific template.
19
- Info {
20
- name: String,
21
- },
22
- }
23
-
24
- pub enum CompilationMode {
25
- /// Real-time compilation mode, for compiling files as soon as possible.
26
- RealTime,
27
-
28
- /// Batch compilation mode, for compiling files one by one.
29
- Batch,
30
-
31
- /// Check mode, used for analyzing the code without compiling it.
32
- Check,
33
- }
34
-
35
- #[derive(Subcommand)]
36
- pub enum CliCommands {
37
- /// Build the program and generate output files.
38
- ///
39
- /// ### Arguments
40
- /// - `entry` - The entry point of the program to build. Defaults to "./src".
41
- /// - `output` - The directory where the output files will be generated. Defaults to "./output".
42
- /// - `watch` - Whether to watch for changes and rebuild. Defaults to "true".
43
- ///
44
- /// ### Example
45
- /// ```bash
46
- /// devalang build --entry ./src --output ./output --watch true
47
- /// ```
48
- ///
49
- Build {
50
- #[arg(short, long, default_value = "./src")]
51
- /// The entry point of the program to build.
52
- ///
53
- /// ### Default value
54
- /// - `./src`
55
- ///
56
- entry: String,
57
-
58
- #[arg(short, long, default_value = "./output")]
59
- /// The directory where the output files will be generated.
60
- ///
61
- /// ### Default value
62
- /// - `./output`
63
- ///
64
- output: String,
65
-
66
- #[arg(short, long, default_value = "true")]
67
- /// Whether to watch for changes and rebuild.
68
- ///
69
- /// ### Default value
70
- /// - `true`
71
- ///
72
- watch: String,
73
-
74
- #[arg(long, default_value = "real-time")]
75
- /// The mode of compilation.
76
- ///
77
- /// ### Default value
78
- /// - `real-time`
79
- ///
80
- /// ### Possible values
81
- /// - `real-time` - Compiles files as soon as possible.
82
- /// - `batch` - Compiles files one by one.
83
- /// - `check` - Analyzes the code without compiling it.
84
- ///
85
- compilation_mode: String,
86
-
87
- #[arg(short, long, default_value = "false")]
88
- /// Whether to print debug information.
89
- ///
90
- /// ### Default value
91
- /// - `false`
92
- ///
93
- debug: String,
94
-
95
- #[arg(short, long, default_value = "false")]
96
- /// Whether to compress the output files.
97
- ///
98
- /// ### Default value
99
- /// - `false`
100
- ///
101
- compress: String,
102
- },
103
-
104
- /// Analyze the program for errors and warnings.
105
- ///
106
- /// ### Arguments
107
- /// - `entry` - The entry point of the program to analyze. Defaults to "./src".
108
- /// - `watch` - Whether to watch for changes and re-analyze. Defaults to "true".
109
- ///
110
- /// ### Example
111
- /// ```bash
112
- /// devalang check --entry ./src --watch true --compilation-mode real-time
113
- /// ```
114
- Check {
115
- #[arg(short, long, default_value = "./src")]
116
- /// The entry point of the program to analyze.
117
- ///
118
- /// ### Default value
119
- /// - `./src`
120
- ///
121
- entry: String,
122
-
123
- #[arg(short, long, default_value = "./output")]
124
- /// The directory where the output files will be generated.
125
- ///
126
- /// ### Default value
127
- /// - `./output`
128
- ///
129
- output: String,
130
-
131
- #[arg(short, long, default_value = "false")]
132
- /// Whether to watch for changes and re-analyze.
133
- ///
134
- /// ### Default value
135
- /// - `false`
136
- ///
137
- watch: String,
138
-
139
- #[arg(short, long, default_value = "real-time")]
140
- /// The mode of compilation.
141
- ///
142
- /// ### Default value
143
- /// - `real-time`
144
- ///
145
- /// ### Possible values
146
- /// - `real-time` - Analyzes files as soon as possible.
147
- /// - `batch` - Analyzes files one by one.
148
- /// - `check` - Analyzes the code without compiling it.
149
- ///
150
- compilation_mode: String,
151
-
152
- #[arg(short, long, default_value = "false")]
153
- /// Whether to print debug information.
154
- ///
155
- /// ### Default value
156
- /// - `false`
157
- ///
158
- debug: String,
159
- },
160
- }
@@ -1,7 +0,0 @@
1
- pub mod token;
2
- pub mod statement;
3
- pub mod variable;
4
- pub mod store;
5
- pub mod parser;
6
- pub mod module;
7
- pub mod cli;