Commit Graph

19 Commits

Author SHA1 Message Date
cb8e97eceb 🚨🦀 Setup Rust -> WASM 🦀🚨 (#28)
* initial tokeniser to wasm port

* fix tests

* add wasm to build script

* add rust tools to test action

* tweaks

* maybe tests will be happy

* tweak simple server

* trying to get tests to pass

* it pget vercel to build

* tidy up

* clean up rust files

* change lexer to use recursion so that it's consistent with the rest of the interpreter

* clean up nokeniser further

* rename variables

* readme typos

* run rust tests in CI

* follow clippy's advice

* more clippy clean up

* setup up proper serialzation to js-land

* tidy init promise in tests
2023-02-21 09:42:41 +11:00
594d55576a functional sketch working (#26)
* functional sketch working

With old sketch block still there

* get all version of lines working with add line and update line

* remove old ui state types

* some clean up

* rename some things

* add todo for multi cursor

* shorten useStore repitition

* small type improvement

* big overhaul to group sketch function and they ast modifying helpers together

* unneeded tweak

* ruthlessly rip out sketch logic

* clean up path keyword

* getting sketch on face working again with all the new sketch line types

* add a bunch of tests and re-arrage file structure
2023-02-12 10:56:45 +11:00
29e06ec852 Add non-code metadata to the ast (#15)
* Revert "wire up comments to ui (#11)"

This reverts commit bdf778530f.

* Revert "Add the ability to recast comments and some whitespace (#10)"

This reverts commit dd5022b38e.

* ast metadata

* clean up
2023-02-01 07:30:55 +11:00
dd5022b38e Add the ability to recast comments and some whitespace (#10)
* Add the ability to recast comments and some whitespace

Currently because whitespace or anything that's not needed for execution is not stored in the AST, it's hard to respect things like user formatting when recasting.

I think having a by-default-opinioned formatter is a good thing, but where this becomes problematic is when users wants to simply leave a blank space between some lines for a bit of breathing room, a code paragraph if you will, but maybe more importantly comments have not been implemented for the same reason, there wasn't a way with the current setup to insert them back in.

In some ways the most straightforward way to do this is to put whitespace and comments into the AST. Even though they are not crucial for execution, code-gen/recasting needs to be a first-class citizen in this lang so that's probably the long-term solution. However I'm trying to draw inspiration from other languages, and since it's not the norm to put comments et-al into the AST I haven't done so.

Because whitespace is tokenised already if not transformed into the AST, there is somewhat of a map of these things without going back to source code, so atm I'm experimenting with using this to insert extra linebreaks and comments back in between statements. I think this is a good compromise for the time being for what is a nice to have feature atm.

Because it's only going to respect non-code parts in between statements this will mean that you can't format objects or function params how you like (but I think this is good to have an opinioned fmt out of the box) and comments like myFunctionCall('a', /* inline comment */ b) will not work either.

* clean up
2023-01-23 14:50:58 +11:00
e37f68424b Improved math expressions (#6)
* Improved math expressions

Things are in a better state, + - / * work now for basic const var = 5 <operator> 1

Though the current method I'm using to make the ast isn't really going to work for dealing with precedence rules so some refactoring is needed going forward

* get complex math expressions working with precedence including parans

Node that identifiers are working, call expressions are not, that's a TODO
/ * % + - are working both other things like exponent and logical operators are also not working.
Recasting is the most important thing to implement next

* get recasting working for nested binary expressions

* clean up
2023-01-21 21:23:01 +11:00
a1f844b0b1 add member expression 2023-01-03 19:41:27 +11:00
d2a4bb7851 refactor makeValue and makeDeclatator to reduce code duplication 2023-01-02 12:20:32 +11:00
dbf8a993e5 add object declarations 2023-01-01 21:48:30 +11:00
3d6f5982c2 add array declarations 2022-12-30 21:53:50 +11:00
f0076309ef pipe working for everything except sketches 2022-12-03 22:50:46 +11:00
15bddcc842 add pipe operator to tokeniser and ast
Executor and recast TODO
2022-12-02 21:00:57 +11:00
48e59ac710 remove semi-colons 2022-11-26 08:38:57 +11:00
dd140d041a add ast for sketch expression 2022-11-20 17:50:17 +11:00
082730bb2e Refactor executor to make it able to call recursively
and Add variable declarator using callExpression AST test
2022-11-20 09:41:21 +11:00
c7be6e592c add function declaration with input params< 2022-11-18 08:20:18 +11:00
7ebfba46e2 start of function declaration 2022-11-17 20:17:00 +11:00
e89241de92 add find-closing-brace util function 2022-11-17 16:06:38 +11:00
aed0763770 Add callee expression parsing 2022-11-14 13:28:16 +11:00
24189282ec re-arrange folder 2022-11-13 11:15:35 +11:00