add serialization of values
This commit is contained in:
parent
da82c775db
commit
6350e4a40f
5 changed files with 87 additions and 26 deletions
15
example/run.rs
Normal file
15
example/run.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
use std::{env::args, fs};
|
||||
|
||||
use microlang::Context;
|
||||
|
||||
pub fn main() {
|
||||
unsafe { backtrace_on_stack_overflow::enable() };
|
||||
let mut context = Context::empty();
|
||||
let lines = fs::read_to_string(args().nth(1).expect("Pass a file as arg 1.")).expect("File could not be read.");
|
||||
for line in lines.lines() {
|
||||
match context.eval(line.into()) {
|
||||
Err(err) => panic!("Failed : {err:?}"),
|
||||
Ok((_, value)) => println!("{}", value.serialize()),
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue