https://github.com/psilospore/lambda_interpreter
A lambda calculus tool in javascript
https://github.com/psilospore/lambda_interpreter
Last synced: 3 months ago
JSON representation
A lambda calculus tool in javascript
- Host: GitHub
- URL: https://github.com/psilospore/lambda_interpreter
- Owner: psilospore
- Created: 2015-02-14T06:14:19.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-25T04:23:53.000Z (about 10 years ago)
- Last Synced: 2025-02-24T03:03:47.058Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 496 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# lambda_interpreter
An online lambda calculus tool that is still in development.
lambda.pegjs:
* The grammar for parsing the lambda_calculus. Returns an Abstract Syntax Tree.
* Run the command ```pegjs lambda.pegjs``` to create lambda.js
lambda_util.js:
* ast_string: Takes an Abstract Syntax Tree and forms a string by pre-order traversal.
Example:
example_script.js:
````
...
ast1 = lambda_peg.parse("x");
ast2 = lambda_peg.parse("lambda x. y");
ast3 = lambda_peg.parse(" (λ x. y)(z) ");console.log(lambda_util.ast_string(ast1));
console.log(lambda_util.ast_string(ast2));
console.log(lambda_util.ast_string(ast3));
````
The command:
````
node example_script.js
````
produces output:
````
ast(expr(var(x)))
ast(expr(function(λvar(x).(expr(var(y))))))
ast(expr(app(expr(function(λvar(x).(expr(var(y))))) , expr(var(z)))))
````## To do list
* Beta reduction function
* Well formed function
* Use [JointJS](http://jointjs.com/tutorial) to form a visual graph of the AST.
* Make a GUI to interact with or some embbed html command like tool.
* Separate simply typed lambda calculus tool
## Update
I don't have much experience with web stuff so this may take me a while.
Idea so far:
use socket.ioWhen text box onChangedText event{
parse text to server
server forms ast from text unless invalid then send "invalid text"
send json ast to client
client forms joint.js ast visual representation
}