feat(tazjin/rlox): Parse variable assignment & access
Change-Id: I9894d76716d739e85a4757d9e658f884228e7f52 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2290 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
This commit is contained in:
parent
5010b79718
commit
0f9a7b3f86
3 changed files with 46 additions and 3 deletions
|
|
@ -101,6 +101,7 @@ fn eval<'a>(expr: &Expr<'a>) -> Result<Literal, Error> {
|
|||
Expr::Grouping(grouping) => eval(&*grouping.0),
|
||||
Expr::Unary(unary) => eval_unary(unary),
|
||||
Expr::Binary(binary) => eval_binary(binary),
|
||||
Expr::Variable(_) => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -122,6 +123,7 @@ fn run_program<'a>(program: &Program<'a>) -> Result<(), Error> {
|
|||
for decl in program {
|
||||
match decl {
|
||||
Declaration::Stmt(stmt) => run_stmt(stmt)?,
|
||||
Declaration::Var(_var) => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue