Git Product home page Git Product logo

disco's People

Contributors

stefan-brus avatar

Watchers

 avatar  avatar

disco's Issues

Create new repository for utility modules

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 suite

Create a test program that evaluates a series of Disco expressions, and compares the results to the expected value.

Add basic built-in functions

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.

Enable higher-order functions

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.

Implement tail recursion

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.

Typing function names crashes disco

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.

Modularize the program

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

Add more built-in functions

The following functions should be implemented:

length
cons
car
cdr
append
list
isList
isNumber
isSymbol
isNil

Add mathematical operator functions

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 comparison operators

Add the standard comparison operators as functions. The following comparisons should be implemented: ==, !=, >, <, >=, <=

Add quote operator

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))

Fix math functions

The math functions don't function properly. The following input:

(set lst (quote (1 2)))
(+ (car lst) 2)

Throws an exception.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.