-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.mdl
More file actions
130 lines (106 loc) · 2.63 KB
/
test.mdl
File metadata and controls
130 lines (106 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
program.set[
name: "MyProject",
author: {"Simone", "Edo"},
version: {
debug: "1.0.0-dev",
release: "1.0.0"
},
description: "Demo del linguaggio ZigVM",
license: "MIT",
homepage: "https://yoururl.com", // non funziona se uso tramite io
created: "2025-12-10",
tags: {"programming", "tech"}
]
io.print as txt "-----------------------------------"
io.warn ("nome progetto: " .. (program.name))
io.warn ("nome autore: " .. (program.author))
io.warn ("version di debug: " .. (program.version.debug))
io.warn ("version di release: " .. (program.version.release))
io.warn ("descrizione: " .. (program.description))
// ...
io.print as txt "-----------------------------------"
section Test0{{
io.print as txt "wow from the bytecode loaded with the bytecode func"
}}
section Test{{
VAR(x): 10
VAR(y): 3
}}
section Believe{{
(x): 20
(y): 9
io.warn (x)
io.print as u8 255
io.print ((x) .. (y))
}}
section IfAndElse{{
var(eta): 5
if (eta) == 5 {
io.print as txt "x e 5"
}
io.print as txt "Dopo if"
}}
section ChooseTest{{
io.print as txt "Test Choose:"
var(result): choose {
60 => 1
30 => 2
10 => 3
}
io.print as txt "Risultato scelto:"
io.print (result)
var(msg): choose {
0 => "Opzione A"
0 => "Opzione B"
100 => "Opzione C"
}
io.print as txt "Messaggio:"
io.print (msg)
choose {
60 => io.warn as u8 1
40 => io.warn as u8 2
}
VAR(age): io.input "scrivi qui la tua eta' -> "
io.print ("la tua eta' e' " .. (age))
}}
section New {{
fun Add10(x) {
var(result): ((x) + 10)
return (result)
}
fun Printo() {
io.print("ciao")
io.print ("fasu")
}
var(test): Add10(5)
io.print (test) // Output: 15
Printo()
Printo()
bytecode "070400746573740e0800696f2e7072696e74" // printa 15
}}
section pipelinn{{
stage ProcessData(input) {
var(processed): (input) * 2
return (processed)
}
stage ProcessData2(input) {
var(processed2): (input) + 4
return (processed2)
}
pipeline MyPipeline {
stages: [ProcessData, ProcessData2],
parallel: false, // Esecuzione sequenziale
timeout: 5000 // Timeout in ms
}
var(myinput): 10
// Uso:
var(output): pipeline(MyPipeline)(myinput)
io.warn ("output dalla pipeline: " .. (output))
}}
program.run[
order: {Test, Believe, IfAndElse, ChooseTest, New, pipelinn},
mode: release,
repeat: 1,
trace: true,
onerror: stop
]