October commit

- custom parser support and infra
- type-tagging and traits (untested)
- match expressions
This commit is contained in:
2023-10-24 22:17:37 +01:00
parent c961506a3a
commit f77e4fd90a
73 changed files with 1904 additions and 558 deletions

View File

@@ -1,5 +1,5 @@
use std::fmt::Display;
use std::rc::Rc;
use std::sync::Arc;
use crate::foreign::{xfn_1ary, ExternError, XfnResult};
use crate::interpreted::Clause;
@@ -7,7 +7,8 @@ use crate::{ConstTree, Interner, OrcString};
/// An unrecoverable error in Orchid land. Because Orchid is lazy, this only
/// invalidates expressions that reference the one that generated it.
pub struct OrchidPanic(Rc<String>);
#[derive(Clone)]
pub struct OrchidPanic(Arc<String>);
impl Display for OrchidPanic {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@@ -20,7 +21,7 @@ impl ExternError for OrchidPanic {}
/// Takes a message, returns an [ExternError] unconditionally.
pub fn orc_panic(msg: OrcString) -> XfnResult<Clause> {
// any return value would work, but Clause is the simplest
Err(OrchidPanic(Rc::new(msg.get_string())).into_extern())
Err(OrchidPanic(Arc::new(msg.get_string())).into_extern())
}
pub fn panic(i: &Interner) -> ConstTree {