anubh-v / non-deterministic-source Goto Github PK
View Code? Open in Web Editor NEWMetacircular evaluator for a non-deterministic language (based on SICP JS: https://sicp.comp.nus.edu.sg/chapters/85)
Metacircular evaluator for a non-deterministic language (based on SICP JS: https://sicp.comp.nus.edu.sg/chapters/85)
Currently, the REPL has no memory, i.e names declared in an iteration of the loop are only accessible in the iteration in which they are declared. In subsequent iterations, an Unbound name
error occurs when the name is accessed.
Having the ability to reference names declared in previous iterations will increase the ease with which more complex programs can be written.
To reproduce:
parse_and_eval("const f = 1; f = 3; f;");
Expected: An error message indicating we cannot mutate the value of f
Observed: Value of f
becomes 3
This is not a bug, rather a limitation.
This mechanism did not exist in the evaluator that we started from
Currently, we lack support for:
for
/ while
loopsbreak
and continue
keywordsNeed to decide if this in within scope
This is required for baseline goals.
Do we include as many as we can / all programs in the textbook?
Here are some of the simpler programs:
is_element_of
(present in existing tests)an_integer_starting_from
an_integer_between
prime_sum_pair
a_pythagorean_triple_between
Logic puzzle on multiple dwellings (requires the distinct
list function)
Currently, a global variable final_result
is used to capture the result of an amb
statement. When try_again
is invoked, final_result
is updated with the new value while try_again
returns undefined
.
Having try_again
return a value can provide a cleaner way of accessing the new value.
Currently, testing of functionality that involves errors is not feasible. This is due to the error
function which aborts the program.
As such, instead of invoking error
when needed, the following can be done:
Keep track of the error message in a global data structure.
Subsequently check the error messages stored in the data structure as part of the tests in order to verify the expected behaviour of the program.
Eg.
const f = x => x + 10; f(12);
Error shown: Line 534: Expected 3 arguments, but got 1.
The bug may lie in analyze_return
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.