2022-08-19 12:41:58 +00:00
|
|
|
use ir::{Diagnostics, SourceProgram};
|
|
|
|
|
2022-08-01 05:32:47 +00:00
|
|
|
// ANCHOR: jar_struct
|
|
|
|
#[salsa::jar(db = Db)]
|
|
|
|
pub struct Jar(
|
2022-08-19 12:41:58 +00:00
|
|
|
crate::compile::compile,
|
2022-08-03 04:41:36 +00:00
|
|
|
crate::ir::SourceProgram,
|
2022-08-19 09:53:33 +00:00
|
|
|
crate::ir::Program,
|
2022-08-01 05:32:47 +00:00
|
|
|
crate::ir::VariableId,
|
|
|
|
crate::ir::FunctionId,
|
|
|
|
crate::ir::Function,
|
|
|
|
crate::ir::Diagnostics,
|
2022-08-19 10:46:54 +00:00
|
|
|
crate::ir::Span,
|
2022-08-01 05:32:47 +00:00
|
|
|
crate::parser::parse_statements,
|
2022-08-19 10:46:54 +00:00
|
|
|
crate::type_check::type_check_program,
|
2022-08-19 12:41:58 +00:00
|
|
|
crate::type_check::type_check_function,
|
|
|
|
crate::type_check::find_function,
|
2022-08-01 05:32:47 +00:00
|
|
|
);
|
|
|
|
// ANCHOR_END: jar_struct
|
|
|
|
|
|
|
|
// ANCHOR: jar_db
|
|
|
|
pub trait Db: salsa::DbWithJar<Jar> {}
|
|
|
|
// ANCHOR_END: jar_db
|
|
|
|
|
|
|
|
// ANCHOR: jar_db_impl
|
|
|
|
impl<DB> Db for DB where DB: ?Sized + salsa::DbWithJar<Jar> {}
|
|
|
|
// ANCHOR_END: jar_db_impl
|
|
|
|
|
2022-08-19 12:41:58 +00:00
|
|
|
mod compile;
|
2022-08-01 05:32:47 +00:00
|
|
|
mod db;
|
|
|
|
mod ir;
|
|
|
|
mod parser;
|
2022-08-19 12:41:58 +00:00
|
|
|
mod type_check;
|
2022-08-01 05:32:47 +00:00
|
|
|
|
2022-08-19 12:41:58 +00:00
|
|
|
pub fn main() {
|
2022-09-03 21:48:24 +00:00
|
|
|
let db = db::Database::default();
|
|
|
|
let source_program = SourceProgram::new(&db, String::new());
|
2022-08-19 12:41:58 +00:00
|
|
|
compile::compile(&db, source_program);
|
|
|
|
let diagnostics = compile::compile::accumulated::<Diagnostics>(&db, source_program);
|
|
|
|
eprintln!("{diagnostics:?}");
|
|
|
|
}
|