queso-lang / queso Goto Github PK
View Code? Open in Web Editor NEW๐ง A delicious programming language
License: Apache License 2.0
๐ง A delicious programming language
License: Apache License 2.0
The problem
Considering that the language uses the everything is an expression
notion, it is sometimes hard not to return anything.
Example of how it can be done currently (in spec)
fn foo(x): {
trace x; // trace x normally returns x which is not what we want here (for some reason)
null; // we don't want to return anything (return null)
}
The ~
null-value may be a prefix operator which simply evaluates the following expression but returns null instead.
fn foo(x): ~ trace x;
// the return value of trace x (which is x) is discarded
fn foo(x, y): {
bar(x);
~ trace y;
}
which might also be done this way (since a block is an expression):
fn foo(x, y): ~ {
bar(x);
trace y;
}
in my opinion this is extremely useful and makes a lot of sense.
for loops - normally they return an array made out of the return values of every iteration
fn foo(x, y): ~ for n in 0..5 -> trace n;
let bar = foo();
This is a useful tool implementation-wise. Here, with proper optimization, the array doesn't have to be created at all. That would be easy to implement even for examples such as:
fn foo(x, y): for n in 0..5 -> trace n;
let bar = ~ foo();
if..else if..else
fn foo(x, y):
~ if x -> trace x
else if y -> trace y;
This simply returns nothing, no need for this:
fn foo(x, y):
if x -> ~ trace x
else if y -> ~ trace y;
Alternatives
Develop a pipeline for various execution stages and streamline error handling with Result<,QuesoError>
The problem
Currently, the interpreter spits out the bytecode instructions, which is needed for debugging, but is not disableable at this time, which creates a mess, sometimes.
The solution
Parse cli arguments and turn on or off debugging/verbose printing for certain parts of the interpreter.
Something like:
queso --verbose
queso --verbose=[toks,ast,instrs]
Currently, only the lines of the tokens are stored within the chunk (alongside instructions). Some are not even the correct lines.
The chunk should simply store the whole TokenPos
.
Add support for the:
queso <file>
in the CLI and in the interpretertrace
and error reportingGet a simple lexer for most of the lexical grammar up and running
Describe the bug
mut a = 5; trace a + {mut b = 3; b}
This should print 8, and yet it prints 10.
It has to do with the resolver assigning the first slot of the stack to a, and the second to b, but then the VM puts a on the first slot, then copies it to the second slot (because it's accessed after trace) and then b on the third slot instead of the second, so the last b actually copies a again.
Expected behavior
Prints 8.
Describe the bug
When the parser gets ahold of a certain unexpected token (an identifier, for example) it start an infinite loop of
[1:0-1] Expected a SEMI after expression
[1:0-1] Expected an expression
To Reproduce
cargo run
$
or thingy
or .
etc.Expected behavior
The parser handles the error gracefully
This will make running programs possible and will make it possible to extend e.g. the parser easily
Implement expression parsing with a rule table
Add support for the:
The problem
Currently, the AST visualisation is string based which is not the best.
The solution
Hook up graphviz or some other graph visualisation library.
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.