Various progress, doesnt compile
Added prelude, made lambdas a single-token prefix like NS, made progress on implementations, removed const line type
This commit is contained in:
@@ -25,8 +25,10 @@ use orchid_host::expr::PathSetBuilder;
|
||||
use orchid_host::extension::Extension;
|
||||
use orchid_host::lex::lex;
|
||||
use orchid_host::parse::{HostParseCtxImpl, parse_expr, parse_items};
|
||||
use orchid_host::parsed::{Item, ItemKind, ParsedMember, ParsedMemberKind, ParsedModule};
|
||||
use orchid_host::subprocess::ext_command;
|
||||
use orchid_host::system::init_systems;
|
||||
use orchid_host::tree::Root;
|
||||
use substack::Substack;
|
||||
use tokio::task::{LocalSet, spawn_local};
|
||||
|
||||
@@ -194,6 +196,7 @@ async fn main() -> io::Result<ExitCode> {
|
||||
},
|
||||
Commands::Execute { proj, code } => {
|
||||
let reporter = Reporter::new();
|
||||
let path = sym!(usercode::entrypoint; i).await;
|
||||
let (mut root, systems) = init_systems(&args.system, &extensions).await.unwrap();
|
||||
if let Some(proj_path) = proj {
|
||||
let path = PathBuf::from(proj_path.into_std_path_buf());
|
||||
@@ -206,25 +209,18 @@ async fn main() -> io::Result<ExitCode> {
|
||||
},
|
||||
}
|
||||
}
|
||||
let lexemes =
|
||||
lex(i.i(code.trim()).await, sym!(usercode; i).await, &systems, ctx).await.unwrap();
|
||||
let lexemes = lex(i.i(code.trim()).await, path.clone(), &systems, ctx).await.unwrap();
|
||||
let snippet = Snippet::new(&lexemes[0], &lexemes);
|
||||
if args.logs {
|
||||
println!("lexed: {}", take_first(&ttv_fmt(&lexemes, &FmtCtxImpl { i }).await, true));
|
||||
}
|
||||
let path = sym!(usercode; i).await;
|
||||
let parse_ctx = HostParseCtxImpl {
|
||||
ctx: ctx.clone(),
|
||||
rep: &reporter,
|
||||
src: path.clone(),
|
||||
systems: &systems[..],
|
||||
};
|
||||
let parse_res = parse_expr(
|
||||
&parse_ctx,
|
||||
path.clone(),
|
||||
PathSetBuilder::new(),
|
||||
Snippet::new(&lexemes[0], &lexemes),
|
||||
)
|
||||
.await;
|
||||
let parse_res = parse_expr(&parse_ctx, path.clone(), PathSetBuilder::new(), snippet).await;
|
||||
let expr = match reporter.merge(parse_res) {
|
||||
Ok(expr) => expr,
|
||||
Err(e) => {
|
||||
@@ -233,6 +229,12 @@ async fn main() -> io::Result<ExitCode> {
|
||||
return;
|
||||
},
|
||||
};
|
||||
let parsed_root = ParsedModule::new(true, [Item::new(
|
||||
snippet.sr(),
|
||||
ParsedMember::new(true, i.i("entrypoint").await, expr.clone()),
|
||||
)]);
|
||||
let reporter = Reporter::new();
|
||||
let root = root.add_parsed(&parsed_root, sym!(usercode; i).await, &reporter).await;
|
||||
let mut xctx = ExecCtx::new(ctx.clone(), logger.clone(), root, expr).await;
|
||||
xctx.set_gas(Some(1000));
|
||||
xctx.execute().await;
|
||||
|
||||
Reference in New Issue
Block a user