switch variablechange string to fasteval instruction, add context structure for compiling

This commit is contained in:
Breval Ferrari 2025-05-13 23:05:00 +02:00
parent 227d6bcec3
commit f4e6bd6e3d

View file

@ -12,6 +12,10 @@ package nom {
interface Parser<I>
}
package fasteval {
enum Instruction
}
package parser {
interface TokenParser<I>
interface Token {
@ -29,7 +33,7 @@ package parser {
}
struct VariableChange {
+name: char,
+change: String
+change: Instruction
-parser<'a, I, C: Into<char> + Clone>(variables: &'a [C]): impl TokenParser<I>
}
struct Loop {
@ -90,9 +94,12 @@ package parser {
package compiler {
struct Context {
result: Vec<f64>
variables: HashMap<char, f64>
?
+result: Vec<f64>
+variables: HashMap<char, f64>
+instrument: Instruction
+slopes: HashMap<char, Instruction>
+current_length(&self): f64
+render(&self, n: Option<u8>): Vec<f64>
}
}
@ -109,5 +116,7 @@ parser.TokenParser --|> nomparser_locatedspan: Output = Self, Error = nom::Err<n
nomparser_locatedspan ..|> parser.TokenParser: for any T
parser.Slope --> parser.VariableChange
parser.Token --> compiler.Context
VariableChange --> Instruction
Context --> Instruction
@enduml