phunanon / chika Goto Github PK
View Code? Open in Web Editor NEWS-expression programming language with VM targeting both PC and Arduino.
Home Page: https://phunanon.github.io/Chika
License: GNU General Public License v3.0
S-expression programming language with VM targeting both PC and Arduino.
Home Page: https://phunanon.github.io/Chika
License: GNU General Public License v3.0
Syntax
(file-read "file path") => blob of file contents or nil
(file-write "file path" blob) => boolean of success
(file-append "file path" blob) => boolean of success
Implementation
The ChVM harness will expose these three functions for the same file system dependency as loading programs.
Currently, on a 32-bit system, ChVM::exeForm
requires 24B for parameters and 5B for locals.
Firstly, IType type
before evaluating next argument can be made global, as can probably uint8_t* f
. This would cut down the params to 16B and locals to 4B.
Next, itemnum firstParam
and itemnum nArg
can be managed through a bespoke stack, so that per function call these exist only once and not per every form.
Locals formCode
, firstArgItem
, and formData
can be put on a bespoke stack also.
Finally, as the compiler is aware of the depth of recur's, implicit and explicit returns, it could inform the VM on how far to unroll.
This will generally improve performance as a stack copy is avoided. #4 would see real benefit.
Syntax
(if cond1 (form)) //nil if false
(if cond1 (form1) (else))
(if
cond1 (form1)
cond2 (form2)
...
(else))
Implementation
Extending the already existing if
special form. Evaluates all true conditions' forms, or if no conditions were true the else
form. May be possible to avoid inflation of SpecialFormData
.
Currently very innocuous op's like len
, nth
, type
, not
have their arguments duplicated to the stack before selecting only a small amount of data from them. A new special form for certain op's could ensure parameters and variable bindings are instead served as constants where appropriate. Even sect
could benefit from this, with major rewriting.
It may be possible to have most native operations accept no parameters, as ChVM::iBytes
et al could be globally configured with a pre-calculated byte offset. Then native operations, instead of using p0
, p0 + 1
, etc, could use i(0)
, i(1)
. This would not only simplify code, but pay off in performance as most op's right now calculate a byte offset repeatedly through ChVM::i
or ChVM::iBytes
.
Syntax
(case value
case1 (form)
case2 (form)
...
(else form))
Implementation
As special form, providing short-circuited evaluation. Evaluates the form of the first matching value.
Like Insitux, rather than use form-marking and a separate exeForm(), count the number of arguments to an operation and execute in one for-loop.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.