Skip to content

Commit

Permalink
Merge branch 'v0.2-beta' into 'main'
Browse files Browse the repository at this point in the history
V0.2.25 beta

See merge request mech-lang/mech!88
  • Loading branch information
cmontella committed Dec 17, 2024
2 parents 6c41b4d + dfb7b78 commit 70b57e1
Show file tree
Hide file tree
Showing 49 changed files with 3,229 additions and 1,341 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/rust.yml

This file was deleted.

19 changes: 12 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mech"
version = "0.2.24"
version = "0.2.25"
authors = ["Corey Montella <corey@mech-lang.org>"]
description = "Mech is a reactive programming language for building robots, games, and animations."
documentation = "https://mech-lang.org/docs"
Expand All @@ -18,9 +18,9 @@ gitlab = { repository = "mech-lang/mech", branch = "main" }
maintenance = { status = "actively-developed" }

[dependencies]
mech-core = "0.2.24"
mech-syntax = "0.2.24"
mech-interpreter = "0.2.24"
mech-core = "0.2.25"
mech-syntax = "0.2.25"
mech-interpreter = "0.2.25"

clap = {version = "4.5.21", features = ["cargo"]}
colored = "2.1.0"
Expand Down Expand Up @@ -53,12 +53,17 @@ LegalCopyright = "Copyright © 2024"
mech-core = { path = 'src/core' }
mech-syntax = { path = 'src/syntax'}
mech-interpreter = { path = 'src/interpreter'}
#mech-matrix = { path = '../machines/matrix' }
#mech-stats = { path = '../machines/stats' }
#mech-math = { path = '../machines/math' }
#mech-range = { path = '../machines/range' }
#mech-logic = { path = '../machines/logic' }

[patch.'https://gitlab.com/mech-lang/core']
mech-core = { path = 'src/core', version = '0.2.21' }
mech-core = { path = 'src/core', version = '0.2.25' }

[patch.'https://gitlab.com/mech-lang/syntax']
mech-syntax = { path = 'src/syntax', version = '0.2.21' }
mech-syntax = { path = 'src/syntax', version = '0.2.25' }

[patch.'https://gitlab.com/mech-lang/interpreter']
mech-interpreter = { path = 'src/interpreter', version = '0.2.21' }
mech-interpreter = { path = 'src/interpreter', version = '0.2.25' }
44 changes: 5 additions & 39 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,9 @@ fn main() -> Result<(),MechError> {
//println!("A: {:#?}", result);
let mut intrp = Interpreter::new();
let result = intrp.interpret(&tree)?;
println!("{}", result.pretty_print());


let x = Rc::new(RefCell::new(F64::new(123.0)));
let y = x.clone();
println!("{:?}", x);
println!("{:?}", y);
unsafe {
let mut x_ptr = (&mut *(x.as_ptr()));
(*x_ptr).0 = 456.0;
}
println!("{:?}", x);
println!("{:?}", y);

let xid: u64 = 863861563252387;
let yid: u64 = 29341039262997047;
//let yid =

/*{
let mat_brrw = intrp.symbols.borrow().get(xid).unwrap().borrow().clone();
match mat_brrw {
Value::MatrixF64(Matrix::Matrix1(ref v)) => {
println!("!!!!!!!!!!!!! {:?}", v);
{
unsafe {
let mut sink_ptr = (&mut *(v.as_ptr()));
sink_ptr[0].0 = 3.0;
}
}
println!("!!!!!!!!!!!!! {:?}", v.as_ptr());
}
_ => todo!(),
}
println!("!@#!@$ {:?}", mat_brrw);
}*/


println!("{:#?}", intrp.symbols);
println!("{}", result.pretty_print());

/*{
let plan_brrw = intrp.plan.borrow();
Expand All @@ -78,14 +43,15 @@ fn main() -> Result<(),MechError> {
}

let now = Instant::now();
for _ in 0..1e6 as usize {
let n = 1e3 as usize;
for _ in 0..n {
for fxn in intrp.plan.borrow().iter() {
fxn.solve();
}
}
let elapsed_time = now.elapsed();
let cycle_duration = elapsed_time.as_nanos() as f64;
println!("{:0.2?} ns", cycle_duration / 1000000.0);
println!("{:0.2?} ns", cycle_duration / n as f64);

let tree_string = hash_str(&format!("{:#?}", tree));
println!("{:?}", tree_string);
Expand Down
2 changes: 1 addition & 1 deletion src/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mech-core"
version = "0.2.24"
version = "0.2.25"
authors = ["Corey Montella <corey@mech-lang.org>"]
description = "The Mech language runtime."
documentation = "http://docs.mech-lang.org"
Expand Down
9 changes: 5 additions & 4 deletions src/core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ type Cols = usize;
pub type ParserErrorReport = Vec<ParserErrorContext>;

#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub struct MechError {
pub struct MechError{
pub id: u32,
pub file: String,
pub tokens: Vec<Token>,
pub kind: MechErrorKind,
pub msg: String,
Expand Down Expand Up @@ -72,9 +73,9 @@ pub enum MechErrorKind {
None,
}

impl From<std::io::Error> for MechError {
fn from(n: std::io::Error) -> MechError {
MechError{tokens: vec![], msg: "".to_string(), id: 74892, kind: MechErrorKind::IoError}
impl From<std::io::Error> for MechError{
fn from(n: std::io::Error) -> MechError{
MechError{file: file!().to_string(), tokens: vec![], msg: "".to_string(), id: 74892, kind: MechErrorKind::IoError}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/src/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl Kind {
Kind::Scalar(id) => {
match functions.borrow().kinds.get(id).cloned() {
Some(val_knd) => Ok(val_knd),
None => Err(MechError{tokens: vec![], msg: file!().to_string(), id: line!(), kind: MechErrorKind::UndefinedKind(*id)}),
None => Err(MechError{file: file!().to_string(), tokens: vec![], msg: "".to_string(), id: line!(), kind: MechErrorKind::UndefinedKind(*id)}),
}
},
Kind::Matrix(knd,size) => {
Expand Down
Loading

0 comments on commit 70b57e1

Please sign in to comment.