From e3cdfec0d9fe73cb596df2abdcfcb368a52fe824 Mon Sep 17 00:00:00 2001 From: Goren Barak Date: Sun, 24 Dec 2023 10:43:15 -0500 Subject: [PATCH] Started working on a holeybytes backend. --- src/codegen/fasm.rs | 2 +- src/codegen/mod.rs | 1 + src/main.rs | 12 +++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/codegen/fasm.rs b/src/codegen/fasm.rs index a682f50..7932e09 100644 --- a/src/codegen/fasm.rs +++ b/src/codegen/fasm.rs @@ -16,7 +16,7 @@ impl FasmCodegen { ($exprs:expr) => {{ self.fasm_codegen($exprs, true) }}; - + (fun: $exprs:expr) => {{ self.fasm_codegen($exprs, false) }}; diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 6688d7b..d62b332 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -1 +1,2 @@ +pub mod holeybytes; pub mod fasm; diff --git a/src/main.rs b/src/main.rs index f0d216b..773498a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,6 @@ +#![allow(warnings)] +#![feature(unsized_locals)] +#![feature(arc_unwrap_or_clone)] #![feature(associated_type_bounds)] pub mod lex; pub mod codegen; @@ -16,13 +19,12 @@ macro_rules! arrow { } fn main() { - let parsed = "3*10+5/5%12"; - - let mut lexer = Token::lexer(parsed); - + let mut args = std::env::args(); + let (_, parsed) = (args.next(), args.next().unwrap()); + let mut lexer = Token::lexer(parsed.as_str()); println!("\"{}\"", parsed); arrow!(" "); - println!("{:?}", lex_str(parsed)); + println!("{:?}", lex_str(parsed.as_str())); arrow!(" "); let parsed = parse_math(lexer); println!("{:?}", parsed);