zij-it / lamb Goto Github PK
View Code? Open in Web Editor NEWA small functional programming language
Home Page: https://zij-it.github.io/lamb/
License: Apache License 2.0
A small functional programming language
Home Page: https://zij-it.github.io/lamb/
License: Apache License 2.0
Printing an empty array results in:
>>> println([]);
]
This is due to the check being incorrect for the pop
pop
The garbage collector is currently really just a garbage tracker. It doesn't do anything with the garbage, and just holds it in a nice little list.
Similar to the original C++ version, it is going to be a mark and sweep GC. The first implementation should not use unsafe.
Currently the following results in a parsing error:
>>> case x {
>>> -1 -> 1,
>>> 1 -> -1,
>>> }
>>>
Error: [Lamb] Syntax Errors:
╭─[repl:1:1]
│
3 │ -1 -> 1,
│ ┬
│ ╰── Unexpected item: '-'
───╯
This is because -1
is parsed as the positive number 1 preceded by the unary minus. Currently only patterns can be parsed on the left side, and such an operation is not allowed in a pattern.
More specifically, the following line results in a type error:
println(if false { 1 } elif true { 2 } else { 3 });
It appears as though the false
is not popped off of the stack before entering the elif
body, thus resulting in the VM seeing an attempt to call the value false
with the argument 2
.
Sidenote: I really need to go through and verify that all the examples are able to run, or modify them to make sure that they run.
Then I need to set up a way to test each one so that branches can't be merged onto main
without verifying that the examples are able to run successfully
The REPL waits for the entire input before evaluating anything, so it's not possible to use the repl to evaluate expressions like:
>>> 2 + 2
If the user presses <ENTER>
at this point, a new line is created, and nothing is evaluated. If the user attempts to evaluate this expression, it fails with a syntax error because the REPL only reads statements. Thus, the following changes are desired:
println
call and evaluate as if println
expr-statement.A minified version of the problem is this:
{
id := fn(x) -> x;
1 $> id .> { x := id; x } .> { y := id; y };
}
I assume it's because compiling .>
doesn't handle adding a dummy local to the stack
It should be required that all patterns in a series bind the same identifiers. This means that the following should fail to compile because the left pattern is missing the binding b
and the right pattern is missing the binding a
.
case x {
a @ 1 | b @ 2 -> a,
}
This should be caught by a step in between parsing and execution.
Although it was intended that they are supported, neither the lexer nor the parser support floating point numbers. Thus the following leads to a syntax error:
123.123;
The GC could be optimized to instead use the format like in the previous C++
version, meaning that instead of using a hashmap-like impl for the allocations we can instead use the linked-list with raw pointers.
This would also allow for the VM to store a pointer to the Chunk
within the loop, meaning that self.chunk()
can be reduced to (*current_chunk)
.
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.