valeri/src/compiler.cpp

32 lines
735 B
C++
Raw Normal View History

#include "compiler.hpp"
Result<Value> Compiler::compile(Value& expr) {
auto env = TRY(Array::create(_arena));
auto constants = TRY(Array::create(_arena));
return compile_expr(expr);
}
Result<Value> Compiler::compile_expr(Value& expr) {
return Value(TRY(Nil::create(_arena)));
switch (expr.tag()) {
case Tag::Pair:
return compile_list(*expr.to<Pair>());
case Tag::Nil:
case Tag::Bool:
case Tag::Int64:
case Tag::Float:
case Tag::String:
case Tag::Symbol:
case Tag::Syntax:
case Tag::Array:
case Tag::ByteArray:
return ErrorCode::TypeMismatch;
}
return ErrorCode::TypeMismatch;
}
Result<Value> Compiler::compile_list(Pair& expr) {
return ErrorCode::TypeMismatch;
}