forked from Orchid/orchid
The pipeline is finally reasonably clean
This commit is contained in:
@@ -16,9 +16,9 @@ use crate::foreign::cps_box::CPSBox;
|
||||
use crate::foreign::{Atomic, ExternError};
|
||||
use crate::interpreter::HandlerTable;
|
||||
use crate::pipeline::file_loader::embed_to_map;
|
||||
use crate::sourcefile::{FileEntry, Import};
|
||||
use crate::sourcefile::{FileEntry, FileEntryKind, Import};
|
||||
use crate::systems::asynch::{Asynch, MessagePort};
|
||||
use crate::Interner;
|
||||
use crate::{Interner, Location};
|
||||
|
||||
trait_set! {
|
||||
pub trait StreamTable = IntoIterator<Item = (&'static str, IOStream)>
|
||||
@@ -144,10 +144,14 @@ impl<'a, P: MessagePort, ST: StreamTable + 'a> IntoSystem<'a>
|
||||
name: vec!["system".to_string(), "io".to_string()],
|
||||
constants: io_bindings(i, streams).unwrap_tree(),
|
||||
code: embed_to_map::<IOEmbed>(".orc", i),
|
||||
prelude: vec![FileEntry::Import(vec![Import {
|
||||
path: vec![i.i("system"), i.i("io"), i.i("prelude")],
|
||||
name: None,
|
||||
}])],
|
||||
prelude: vec![FileEntry {
|
||||
locations: vec![Location::Unknown],
|
||||
kind: FileEntryKind::Import(vec![Import {
|
||||
location: Location::Unknown,
|
||||
path: vec![i.i("system"), i.i("io"), i.i("prelude")],
|
||||
name: None,
|
||||
}]),
|
||||
}],
|
||||
handlers,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
export operators[ != == ]
|
||||
|
||||
export const not := \bool. if bool then false else true
|
||||
export macro ...$a != ...$b =0x3p36=> (not (...$a == ...$b))
|
||||
export macro ...$a == ...$b =0x3p36=> (equals (...$a) (...$b))
|
||||
macro ...$a != ...$b =0x3p36=> (not (...$a == ...$b))
|
||||
macro ...$a == ...$b =0x3p36=> (equals (...$a) (...$b))
|
||||
export macro if ...$cond then ...$true else ...$false:1 =0x1p84=> (
|
||||
ifthenelse (...$cond) (...$true) (...$false)
|
||||
)
|
||||
|
||||
@@ -18,9 +18,11 @@ export const pass2 := \a.\b.\cont. cont a b
|
||||
]--
|
||||
export const return := \a. \b.a
|
||||
|
||||
export macro ...$prefix $ ...$suffix:1 =0x1p38=> ...$prefix (...$suffix)
|
||||
export macro ...$prefix |> $fn ..$suffix:1 =0x2p32=> $fn (...$prefix) ..$suffix
|
||||
export operators[$ |> =>]
|
||||
|
||||
export macro ($name) => ...$body =0x2p129=> (\$name. ...$body)
|
||||
export macro ($name, ...$argv) => ...$body =0x2p129=> (\$name. (...$argv) => ...$body)
|
||||
macro ...$prefix $ ...$suffix:1 =0x1p38=> ...$prefix (...$suffix)
|
||||
macro ...$prefix |> $fn ..$suffix:1 =0x2p32=> $fn (...$prefix) ..$suffix
|
||||
|
||||
macro ($name) => ...$body =0x2p129=> (\$name. ...$body)
|
||||
macro ($name, ...$argv) => ...$body =0x2p129=> (\$name. (...$argv) => ...$body)
|
||||
macro $name => ...$body =0x1p129=> (\$name. ...$body)
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
export ::[,]
|
||||
export operators[ , ]
|
||||
|
||||
export const foo := \a.a
|
||||
|
||||
@@ -7,9 +7,9 @@ mod conv;
|
||||
mod inspect;
|
||||
mod num;
|
||||
mod panic;
|
||||
mod state;
|
||||
mod stl_system;
|
||||
mod str;
|
||||
mod state;
|
||||
pub use arithmetic_error::ArithmeticError;
|
||||
pub use bin::Binary;
|
||||
pub use num::Numeric;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
export macro ...$a + ...$b =0x2p36=> (add (...$a) (...$b))
|
||||
export macro ...$a - ...$b:1 =0x2p36=> (subtract (...$a) (...$b))
|
||||
export macro ...$a * ...$b =0x1p36=> (multiply (...$a) (...$b))
|
||||
export macro ...$a % ...$b:1 =0x1p36=> (remainder (...$a) (...$b))
|
||||
export macro ...$a / ...$b:1 =0x1p36=> (divide (...$a) (...$b))
|
||||
export operators[ + - * % / ]
|
||||
|
||||
macro ...$a + ...$b =0x2p36=> (add (...$a) (...$b))
|
||||
macro ...$a - ...$b:1 =0x2p36=> (subtract (...$a) (...$b))
|
||||
macro ...$a * ...$b =0x1p36=> (multiply (...$a) (...$b))
|
||||
macro ...$a % ...$b:1 =0x1p36=> (remainder (...$a) (...$b))
|
||||
macro ...$a / ...$b:1 =0x1p36=> (divide (...$a) (...$b))
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import super::fn::=>
|
||||
|
||||
export operators[ ; = ]
|
||||
|
||||
-- remove duplicate ;-s
|
||||
export macro do {
|
||||
...$statement ; ; ...$rest:1
|
||||
@@ -11,6 +13,8 @@ export macro do {
|
||||
} =0x2p130=> statement (...$statement) do { ...$rest }
|
||||
export macro do { ...$return } =0x1p130=> ...$return
|
||||
|
||||
export ::do
|
||||
|
||||
export macro statement (let $name = ...$value) ...$next =0x1p230=> (
|
||||
( \$name. ...$next) (...$value)
|
||||
)
|
||||
|
||||
@@ -13,7 +13,8 @@ use super::str::str;
|
||||
use crate::facade::{IntoSystem, System};
|
||||
use crate::interner::Interner;
|
||||
use crate::pipeline::file_loader::embed_to_map;
|
||||
use crate::sourcefile::{FileEntry, Import};
|
||||
use crate::sourcefile::{FileEntry, FileEntryKind, Import};
|
||||
use crate::Location;
|
||||
|
||||
/// Feature flags for the STL.
|
||||
#[derive(Default)]
|
||||
@@ -29,8 +30,6 @@ pub struct StlConfig {
|
||||
#[include = "*.orc"]
|
||||
struct StlEmbed;
|
||||
|
||||
// TODO: fix all orc modules to not rely on prelude
|
||||
|
||||
impl IntoSystem<'static> for StlConfig {
|
||||
fn into_system(self, i: &Interner) -> System<'static> {
|
||||
let pure_fns =
|
||||
@@ -41,10 +40,14 @@ impl IntoSystem<'static> for StlConfig {
|
||||
name: vec!["std".to_string()],
|
||||
constants: HashMap::from([(i.i("std"), fns)]),
|
||||
code: embed_to_map::<StlEmbed>(".orc", i),
|
||||
prelude: vec![FileEntry::Import(vec![Import {
|
||||
path: vec![i.i("std"), i.i("prelude")],
|
||||
name: None,
|
||||
}])],
|
||||
prelude: vec![FileEntry {
|
||||
locations: vec![Location::Unknown],
|
||||
kind: FileEntryKind::Import(vec![Import {
|
||||
location: Location::Unknown,
|
||||
path: vec![i.i("std"), i.i("prelude")],
|
||||
name: None,
|
||||
}]),
|
||||
}],
|
||||
handlers: state_handlers(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import super::(proc::*, bool::*, panic)
|
||||
|
||||
export operators[++]
|
||||
|
||||
export macro ...$a ++ ...$b =0x4p36=> (concat (...$a) (...$b))
|
||||
|
||||
export const char_at := \s.\i. do{
|
||||
|
||||
Reference in New Issue
Block a user