sfultong / stand-in-language Goto Github PK
View Code? Open in Web Editor NEWa simple total pure functional language, eventually to have powerful static checking and optimization
License: Apache License 2.0
a simple total pure functional language, eventually to have powerful static checking and optimization
License: Apache License 2.0
It would be nice to have a formal description (in the form of some text document) of the operational semantics of SIL that can be used as a reference instead of having to look at the interpreters and compilers scattered throughout the codebase.
E.G. you should be able to pass AST instructions as arguments, like app (pair zero zero) left
so right now in a .sil file, we could have a line like
test = left {0,0}
left is a keyword, and the parser always expects it to be followed by an argument.
So if I wanted to use it in a function, I'd have to do something like
test = (\f -> f {0,0}) (\x -> left x)
I want to be able to do this instead:
test = (\f -> f {0,0}) left
So we can parse left
as a regular function, but it should also generate the same grammar as before when parsing old syntax (e.g. left {0,0}
)
Currently top-level definitions are just copied directly into other definitions' ASTs.
Instead, top-level bindings should be encapsulated in an extra lambda which then has whatever definitions that binding relies on applied to it.
This technique should also be used for let bindings.
If it makes sense, also fix parsing so that declarations don't have to come before they are used, and make sure recursive definitions are disallowed.
When I do :t succ
in the repl, I would expect to get the same thing as :t (\n -> (n,0))
I think I might be doing partial evaluation in Eval.hs
This is not going to work.
LLVM needs to eventually be written to take a passed in pair heap pointer, and the index to the tree of pairs data.
running line unitTestQC "DataTypedCorrectlyTypeChecks" 1000 quickcheckDataTypedCorrectlyTypeChecks
usually freezes the test suite. This is most likely caused by some sort of type checking bug, which should be fixed.
implement hashing of terms
define llvm functions by their hashes (so automatic deduplication)
Have some sort of memoization store with garbage collection (garbage collection will be run on each iteration of evalLoop or similar "frame")
I want to be able to run all unit tests without running out of memory. Let's say that running them all should take no more than 16GB of memory
This might not produce anything
Right now there's a constant called heapSize, which is ugly. When the type of a SIL expression is data, then we should be able to calculate exactly how many pairs will be generated by running the expression. Then we can get rid of heapSize.
This might actually be a bad idea, but I generally don't like syntactic sugar.
: user specified .o/.so/.DLL could not be loaded (libjumper.so: cannot open shared object file: No such file or directory)
Whilst trying to load: (dynamic) jumper
Additional directories searched: (none)
There are two forms of lambda in the code: (Pair x Env) the regular kind; (Pair x Zero) what I call a "complete lambda". The former binds its outside environment before a value is applied to it; the latter does not.
I have put the wrong form in certain places (and this will eventually show up as errors).
The complete lambdas should only be used when the type of 'x' contains no functions.
We can parse into the intermediate parse AST that only uses regular lambdas, then in an optimization pass convert all eligible lambdas to complete lambdas.
When trying to build SIL using cabal new-build
, I get the following error message:
cabal: Missing dependency on a foreign library:
* Missing (or bad) C library: jumper
Unfortunately, I have no clue what that jumper
library is and from where to get it.
SIL’s type system currently has a special case where PairType ZeroType ZeroType
is merged to ZeroType
. As far as I understand (please correct me if I’m wrong!) the main motivation for this is to have a single type for integers (which are represented as left-associated, nested pairs with 0
elements). IMHO this approach is somewhat problematic and worth reconsidering:
If my understanding of the motivation for the current behavior is correct, then I propose that we remove this special case in the type system and instead add primitive integers (either fixed size or arbitrary-sized integers) to IExpr
and the type system. This would also help with compile time performance and memory usage and remove the need for reconstructing integers in the intermediate representation.
Regardless, of whether you want to stick to the current approach or not, I would very much like to see a formalization of the type system (just in textual form, e.g. typing rules in LaTeX). I believe that would make it significantly easier to understand SIL and help new contributors get started. (I’m happy to work on this, if you want me to).
This will be the same as the core grammar, but with the addition of natural numbers. We may want to add two integer types, one for Church numerals and one for data numbers.
uncomment and debug code in Eval.hs
I thought a bit about how memory management in SIL could work, so let’s use this issue to track ideas.
Personally, I think the two most promising options are the following:
This instruction is redundant.
This is going to be really hard, and may not be worth it. Not necessary for merging llvm2 branch to master.
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.