Skip to content

Commit 3fb2806

Browse files
committed
Tentatively implement op (tests TODO)
1 parent 13e1652 commit 3fb2806

File tree

7 files changed

+452
-16
lines changed

7 files changed

+452
-16
lines changed

Cargo.lock

Lines changed: 131 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ indexmap = "2.10.0"
1212
itertools = "0.14.0"
1313
lalrpop-util = { version = "0.22.2", features = ["lexer"] }
1414
lazy_static = "1.5.0"
15+
noise = "0.9.0"
1516
num-traits = "0.2.19"
17+
rand = "0.9.2"
1618
regex = "1.11.1"
1719
seekable_reader = "0.1.2"
1820
serde = "1.0.219"

src/logic/ast.rs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ pub enum Instruction {
3737
to: Value,
3838
from: Value,
3939
},
40+
Op {
41+
op: LogicOp,
42+
result: Value,
43+
x: Value,
44+
y: Value,
45+
},
4046
Select {
4147
result: Value,
4248
op: ConditionOp,
@@ -112,6 +118,54 @@ pub enum ConditionOp {
112118
Always,
113119
}
114120

121+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
122+
pub enum LogicOp {
123+
Add,
124+
Sub,
125+
Mul,
126+
Div,
127+
Idiv,
128+
Mod,
129+
Emod,
130+
Pow,
131+
132+
Land,
133+
Condition(ConditionOp),
134+
135+
Shl,
136+
Shr,
137+
Ushr,
138+
Or,
139+
And,
140+
Xor,
141+
Not,
142+
143+
Max,
144+
Min,
145+
Angle,
146+
AngleDiff,
147+
Len,
148+
Noise,
149+
Abs,
150+
Sign,
151+
Log,
152+
Logn,
153+
Log10,
154+
Floor,
155+
Ceil,
156+
Round,
157+
Sqrt,
158+
Rand,
159+
160+
Sin,
161+
Cos,
162+
Tan,
163+
164+
Asin,
165+
Acos,
166+
Atan,
167+
}
168+
115169
#[derive(Debug, Clone, PartialEq)]
116170
pub enum Value {
117171
Variable(String),

0 commit comments

Comments
 (0)