|
|
|
|
|
by conradludgate
1703 days ago
|
|
Enums are almost certainly the way to go here. Something like enum Expr {
Literal(Literal),
Binary(Op, Box<Expr>, Box<Expr>),
//...
}
A value with type of Expr could be a literal or a binary expression. Binary expressions contain an operator and two other expressions (boxed to prevent infinite sized types).This is the building block for your tree |
|