switch variablechange string to fasteval instruction, add context structure for compiling
This commit is contained in:
parent
227d6bcec3
commit
f4e6bd6e3d
1 changed files with 13 additions and 4 deletions
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue