Comments (4)
I think the ideal solution goes like this. I think these points correspond to PR-sized chunks.
- We add a new AST kind,
literal
, and we use it for all literals (booleans, numbers, characters, strings, symbols, quoted pairs, etc). We extend the simplifier to be able to know how to get e.g. a raw i32 from a number. Late in the compiler we convert into calls to%make-false
,%make-number
, and so on. - Instead of converting to
%make-number
calls, the compiler changes to collects all literals, de-duplicates them, then assigns each one an index. Literals lower instead totable.get
calls of the corresponding index. We add a start function to Schism's modules which initializes the table by calling into the runtime to allocate the JS string/number/pair/whatever. - We add support for more sensible string literals. For that we will ideally need a data section, and to give schism a memory again; strings will be created by a run-time callout to
(%make-string offset-to-bytes byte-len)
.
This approach also has the advantage of testing the table.get
etc instructions from the anyref work.
from schism.
This plan sounds good to me!
As an alternative to table.get
, could we use globals instead? Overall, I think tables are a better solution (we'd end up with a ridiculous number of globals!), but perhaps globals make sense for particularly well known values like #f
and #t
? I'm guessing table.get
these days is pretty fast, but I suspect it has a bounds check that globals might not.
I think bringing back the Wasm memory opens up some other interesting possibilities. I've been thinking a little about how we'd want to do bytevectors (#37), and keeping the contents in linear memory might let Schism do some relatively fast processing while staying purely within Wasm. Then we could do a bulk copy out into JS when needed.
from schism.
This seems finished now.
from schism.
Well, except for the newer string literal format...
from schism.
Related Issues (20)
- Do we want a SchismValue or similar class?
- Bootstrapping from guile fails: "Unbound variable: %file-exists?" HOT 6
- master playground doesn't work HOT 2
- equal? should handle cyclic structures
- bug related to tail-call-indirect
- Allow multiple tests per test file
- test/list-find.ss fails HOT 1
- Guile bootstrap seems to be broken again? HOT 3
- Add macro expander
- Try µKanren as a test case
- Add support for failure tests
- Add file input ports
- First class procedures HOT 5
- Add a command to compile a file to .wasm HOT 3
- Question: What is the difference between the schism-stageN.wasm HOT 4
- Pass options to Schism.Engine as a dictionary HOT 1
- Remove `list-all-eq?` HOT 6
- README.md review: What does Schism do? HOT 2
- Add test case for string `eq?` behavior HOT 5
- Add some kind of `include-data` macro HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from schism.