haku: more cleanups: remove old unused VM
also remove some leftover TODOs
This commit is contained in:
parent
c80cd1c7fe
commit
8b464d50f4
17 changed files with 114 additions and 1167 deletions
|
@ -5,8 +5,6 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
log.workspace = true
|
||||
tiny-skia = { version = "0.11.4", default-features = false, features = ["no-std-float"] }
|
||||
libm = "0.2.8"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
|
|
@ -12,13 +12,12 @@ use crate::{
|
|||
},
|
||||
diagnostic::Diagnostic,
|
||||
source::SourceCode,
|
||||
system::{System, SystemFnArity},
|
||||
system::{self, SystemFnArity},
|
||||
};
|
||||
|
||||
pub struct Source<'a> {
|
||||
pub code: &'a SourceCode,
|
||||
pub ast: &'a Ast,
|
||||
pub system: &'a System,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
@ -313,7 +312,7 @@ fn compile_unary<'a>(c: &mut Compiler<'a>, src: &Source<'a>, node_id: NodeId) ->
|
|||
let name = src.ast.span(op).slice(src.code);
|
||||
|
||||
compile_expr(c, src, expr)?;
|
||||
if let Some(index) = (src.system.resolve_fn)(SystemFnArity::Unary, name) {
|
||||
if let Some(index) = system::resolve(SystemFnArity::Unary, name) {
|
||||
let argument_count = 1;
|
||||
c.chunk.emit_opcode(Opcode::System)?;
|
||||
c.chunk.emit_u8(index)?;
|
||||
|
@ -353,7 +352,7 @@ fn compile_binary<'a>(c: &mut Compiler<'a>, src: &Source<'a>, node_id: NodeId) -
|
|||
|
||||
compile_expr(c, src, left)?;
|
||||
compile_expr(c, src, right)?;
|
||||
if let Some(index) = (src.system.resolve_fn)(SystemFnArity::Binary, name) {
|
||||
if let Some(index) = system::resolve(SystemFnArity::Binary, name) {
|
||||
let argument_count = 2;
|
||||
c.chunk.emit_opcode(Opcode::System)?;
|
||||
c.chunk.emit_u8(index)?;
|
||||
|
@ -391,7 +390,7 @@ fn compile_call<'a>(c: &mut Compiler<'a>, src: &Source<'a>, node_id: NodeId) ->
|
|||
|
||||
if let (NodeKind::Ident, Some(index)) = (
|
||||
src.ast.kind(func),
|
||||
(src.system.resolve_fn)(SystemFnArity::Nary, name),
|
||||
system::resolve(SystemFnArity::Nary, name),
|
||||
) {
|
||||
c.chunk.emit_opcode(Opcode::System)?;
|
||||
c.chunk.emit_u8(index)?;
|
||||
|
|
|
@ -8,10 +8,10 @@ pub mod compiler;
|
|||
pub mod diagnostic;
|
||||
pub mod lexer;
|
||||
pub mod parser;
|
||||
pub mod render;
|
||||
// pub mod render;
|
||||
pub mod source;
|
||||
pub mod system;
|
||||
pub mod token;
|
||||
pub mod trampoline;
|
||||
pub mod value;
|
||||
pub mod vm;
|
||||
// pub mod trampoline;
|
||||
// pub mod value;
|
||||
// pub mod vm;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,8 @@
|
|||
/*
|
||||
|
||||
// NOTE: The test suite is currently not in service.
|
||||
// We apologise for the inconvenience.
|
||||
|
||||
use std::error::Error;
|
||||
|
||||
use haku::{
|
||||
|
@ -7,10 +12,7 @@ use haku::{
|
|||
lexer::{lex, Lexer},
|
||||
parser::{self, Parser, ParserLimits},
|
||||
source::SourceCode,
|
||||
system::System,
|
||||
token::Lexis,
|
||||
value::{Closure, Ref, RefId, Value},
|
||||
vm::{Vm, VmLimits},
|
||||
};
|
||||
|
||||
fn eval(code: &str) -> Result<Value, Box<dyn Error>> {
|
||||
|
@ -158,7 +160,7 @@ fn def_fib_recursive() {
|
|||
n
|
||||
else
|
||||
fib (n - 1) + fib (n - 2)
|
||||
|
||||
|
||||
fib 10
|
||||
"#;
|
||||
expect_number(code, 55.0, 0.0001);
|
||||
|
@ -309,3 +311,5 @@ fn system_index() {
|
|||
assert!(eval("index [1] (-1)").is_err());
|
||||
assert!(eval("index [1] 1").is_err());
|
||||
}
|
||||
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue