stefan-brus / disco Goto Github PK
View Code? Open in Web Editor NEWA Lisp dialect written in Haskell.
A Lisp dialect written in Haskell.
The util package consists mostly of classes and modules stolen from dmath.util. That entire package, plus the new stuff added to Disco's util package should be in its own repository, and used as a submodule.
Create a test program that evaluates a series of Disco expressions, and compares the results to the expected value.
Add the "%" math operator function.
The global environment should be initialized with the symbols "true" and "false", each bound to their respective boolean value.
Whenver set
or fun
are called, they should throw exceptions if the symbol or function already exists as a built-in in the environment.
The following basic functions should be implemented:
(if bool-exp exp1 exp2)
: If bool-exp, then evaluate exp1, otherwise evaluate exp2
(set var exp)
: Sets the variable var to value of exp
(fun fn-name (args) exp)
: Defines the function fn-name that takes 0 or more args, inserts them into exp, and evaluates exp.
Right now, all arguments to user function calls are stored in the environment as variables.
Add a check to see if one of the arguments is a symbol, and the symbol exists in the parent environment as a function. In this case, the symbol should not be re-bound.
Optimize the evaluation process, so that if the last expression in a function is a recursive call, another stack frame is not created. The argument values should be re-bound, and the function repeated from the beginning.
If the user types in a function name like list
without parentheses or arguments, the program segfaults. Fix this, and make it simply return nil
for now.
My original idea of creating a general evaluator that takes the math operator as its argument didn't work out cause the type system. Look into using TemplateHaskell or something.
Add a built-in function called eval
that takes one or more expressions and evaluates them in order.
Initial proposal:
Parser module for parser functions
Absyn module for expression types
Eval module for evaluation functions and result types
Builtin module for builtin functions
REPL module for repl functions
The following functions should be implemented:
length
cons
car
cdr
append
list
isList
isNumber
isSymbol
isNil
Add the four basic math operators +, -, * and / as functions. They should all be callable with a variable number of arguments (at least 2) like so:
(+ 2 3 4 5 6) // 20
Add the standard comparison operators as functions. The following comparisons should be implemented: ==
, !=
, >
, <
, >=
, <=
Disco should support single quoted S-Expressions, similarly to Lisp. If the user inputs something like:
'(a b c)
Disco should translate that to:
(quote (a b c))
Similar to #16
The math functions don't function properly. The following input:
(set lst (quote (1 2)))
(+ (car lst) 2)
Throws an exception.
This will allow for more efficient error handling.
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.