Compare commits

..

No commits in common. "c62b5c903dbd2f216b08b9e41cef0283c4da503c" and "4dd47dd56c0cb708f23e2182f55ae20156606a6b" have entirely different histories.

5 changed files with 17 additions and 47 deletions

View File

@ -9,7 +9,8 @@ edition = "2021"
crate-type = ["cdylib", "rlib"] crate-type = ["cdylib", "rlib"]
[dependencies] [dependencies]
chumsky = "0.10.1" ariadne = { git = "https://github.com/zesterer/ariadne" }
chumsky = { git = "https://github.com/zesterer/chumsky", features = ["label"] }
imbl = "3.0.0" imbl = "3.0.0"
ran = "2.0.1" ran = "2.0.1"
num-derive = "0.4.2" num-derive = "0.4.2"

View File

@ -1,10 +0,0 @@
wasm:
wasm-pack build --target web
rm pkg/.gitignore
cp pkg/rudus.js pkg/rudus.js.backup
echo 'import {io} from "../worker.js"' > rudus.js
cat rudus.js.backup | tail -n+2>> rudus.js
rm rudus.js.backup
default:
@just --list

View File

@ -1113,26 +1113,23 @@ That leaves the following list:
- Original version of `update` also had this same problem with `assoc`; fixed it by calling the Ludus, rather than Rust, function. - Original version of `update` also had this same problem with `assoc`; fixed it by calling the Ludus, rather than Rust, function.
* [a] `loop`/`recur` is still giving me a very headache. It breaks stack discipline to avoid packing tuples into a heap-allocated vec. There may be a way to fix this in the current compiler scheme around how I do and don't handle arguments--make recur stupider and don't bother loading anything. A different solution would be to desugar loop into an anonymous function call. A final solution would be just to use a heap-allocated tuple. * [a] `loop`/`recur` is still giving me a very headache. It breaks stack discipline to avoid packing tuples into a heap-allocated vec. There may be a way to fix this in the current compiler scheme around how I do and don't handle arguments--make recur stupider and don't bother loading anything. A different solution would be to desugar loop into an anonymous function call. A final solution would be just to use a heap-allocated tuple.
* My javascript wrapper needs to execute WASM in its own thread (ugh) * My javascript wrapper needs to execute WASM in its own thread (ugh)
- [x] is this a thing that can be done easily in a platform-independent way (node vs. bun vs. browser)? - [ ] is this a thing that can be done easily in a platform-independent way (node vs. bun vs. browser)?
- No, no it is not. I will need to build a separate node version for using at the command line (and, like, for testing with our test harness.)
* Top priorities: * Top priorities:
- [-] Get a node package out - [-] Get a node package out
- [x] Stand up actors + threads, etc. - [x] Stand up actors + threads, etc.
- [ ] How to model keyboard input from p5? - [ ] How to model keyboard input from p5?
* [ ] Model after the p5 keyboard input API * [ ] Model after the p5 keyboard input API
* [ ] ludus keyboard API: `key_down?(), key_pressed?(), key_released?()`, key code values (use a dict) * [ ] ludus keyboard API: `key_is_down(), key_pressed(), key_released()`, key code values (use a dict)
* [a] Escape characters in strings: \n, \t, and \{, \}. * [a] Escape characters in strings: \n, \t, and \{, \}.
* [ ] `doc!` needs to print the patterns of a function. * [ ] `doc!` needs to print the patterns of a function.
* [ ] I need to return to the question of whether/how strings are ordered; do we use `at`, or do we want `char_at`? etc. * [ ] I need to return to the question of whether/how strings are ordered; do we use `at`, or do we want `char_at`? etc.
- MNL and I decided: yes, stings are indexable
- [ ] implement `slice` and `at` and others for strings
* [ ] Automate this build process * [ ] Automate this build process
* [ ] Start testing against the cases in `ludus-test` * [ ] Start testing against the cases in `ludus-test`
* [ ] Systematically debug prelude * [ ] Systematically debug prelude
* [ ] Bring it in function by function, testing each in turn - [ ] Bring it in function by function, testing each in turn
* [ ] Animation hooked into the web frontend (Spacewar!) * [ ] Animation hooked into the web frontend (Spacewar!)
* [ ] Text input (Spacewar!) * [ ] Text input (Spacewar!)
* [ ] Makey makey for alternate input? - [ ] Makey makey for alternate input?
* [ ] Saving and loading data into Ludus (perceptrons, dissociated press) * [ ] Saving and loading data into Ludus (perceptrons, dissociated press)
* [ ] Finding corpuses for Dissociated Press * [ ] Finding corpuses for Dissociated Press
* [ ] improve validator * [ ] improve validator
@ -1148,21 +1145,3 @@ That leaves the following list:
* [ ] that suggests that we need a mapping from bytecodes to AST nodes * [ ] that suggests that we need a mapping from bytecodes to AST nodes
* The way I had been planning on doing this is having a vec that moves in lockstep with bytecode that's just references to ast nodes, which are `'static`, so that shouldn't be too bad. But this is per-chunk, which means we need a reference to that vec in the VM. My sense is that what we want is actually a separate data structure that holds the AST nodes--we'll only need them in the sad path, which can be slow. * The way I had been planning on doing this is having a vec that moves in lockstep with bytecode that's just references to ast nodes, which are `'static`, so that shouldn't be too bad. But this is per-chunk, which means we need a reference to that vec in the VM. My sense is that what we want is actually a separate data structure that holds the AST nodes--we'll only need them in the sad path, which can be slow.
### Next steps in integration hell
#### 2025-06-29
* [ ] improve build process for rudus+wasm_pack
- [ ] delete generated .gitignore
- [ ] edit first line of rudus.js to import the local `ludus.js`
* [ ] design & implement asynchronous i/o+runtime
- [ ] use `box`es for i/o: they can be reified in rust: making actors available is rather more complex (i.e. require message passing between the ludus and rust)
* We also then don't have to have prelude run in the vm; that's good
- [ ] start with ludus->rust->js pipeline
* [ ] console
* [ ] turtle graphics
* [ ] completion
- [ ] then js->rust->ludus
* [ ] kill
* [ ] text input
* [ ] keypresses
- [ ] then ludus->rust->js->rust->ludus
* [ ] slurp

View File

@ -1,5 +1,6 @@
// use crate::process::{LErr, Trace}; // use crate::process::{LErr, Trace};
use crate::validator::VErr; use crate::validator::VErr;
use ariadne::{sources, Color, Label, Report, ReportKind};
// pub fn report_panic(err: LErr) { // pub fn report_panic(err: LErr) {
// let mut srcs = HashSet::new(); // let mut srcs = HashSet::new();
@ -41,12 +42,11 @@ use crate::validator::VErr;
pub fn report_invalidation(errs: Vec<VErr>) { pub fn report_invalidation(errs: Vec<VErr>) {
for err in errs { for err in errs {
// Report::build(ReportKind::Error, (err.input, err.span.into_range())) Report::build(ReportKind::Error, (err.input, err.span.into_range()))
// .with_message(err.msg.to_string()) .with_message(err.msg.to_string())
// .with_label(Label::new((err.input, err.span.into_range())).with_color(Color::Cyan)) .with_label(Label::new((err.input, err.span.into_range())).with_color(Color::Cyan))
// .finish() .finish()
// .print(sources(vec![(err.input, err.src)])) .print(sources(vec![(err.input, err.src)]))
// .unwrap(); .unwrap();
println!("{}", err.msg);
} }
} }

View File

@ -62,7 +62,7 @@ fn parse_string(s: &'static str, span: SimpleSpan) -> Result<Vec<Spanned<StringP
if !current_part.is_empty() { if !current_part.is_empty() {
parts.push(( parts.push((
StringPart::Data(current_part), StringPart::Data(current_part),
SimpleSpan::new(span.context(), start..start + i), SimpleSpan::new(start, start + i),
)); ));
}; };
current_part = String::new(); current_part = String::new();
@ -80,7 +80,7 @@ fn parse_string(s: &'static str, span: SimpleSpan) -> Result<Vec<Spanned<StringP
if is_word { if is_word {
parts.push(( parts.push((
StringPart::Word(current_part.clone()), StringPart::Word(current_part.clone()),
SimpleSpan::new(span.context(), start..start + i), SimpleSpan::new(start, start + i),
)); ));
current_part = String::new(); current_part = String::new();
start = i; start = i;
@ -109,13 +109,13 @@ fn parse_string(s: &'static str, span: SimpleSpan) -> Result<Vec<Spanned<StringP
if current_part == s { if current_part == s {
parts.push(( parts.push((
StringPart::Inline(current_part), StringPart::Inline(current_part),
SimpleSpan::new(span.context(), start..span.end), SimpleSpan::new(start, span.end),
)) ))
} else if !current_part.is_empty() { } else if !current_part.is_empty() {
let part_len = current_part.len(); let part_len = current_part.len();
parts.push(( parts.push((
StringPart::Data(current_part), StringPart::Data(current_part),
SimpleSpan::new(span.context(), start..part_len), SimpleSpan::new(start, part_len),
)) ))
} }