Coder Social home page Coder Social logo

rust-calc's People

Contributors

smackem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

hallerpatrick

rust-calc's Issues

Parallel statements

#: should enter parallel mode. All statements entered in parallel mode are stored but not executed. #. leaves parallel mode, executes all stored statements in parallel and prints the results.

JSON file output

Command #w should write out the current context into a JSON file (e.g. ~/rcalc.json).

Grammar extensions for functions

Augment grammar with function declarations:

stmt:
    'let' IDENTIFIER '=' expr
    'let' IDENTIFIER '(' identifier-list ')' '=' expr
    expr

... and function calls:

atom:
    ...
    IDENTIFIER '(' expr-list ')'
    ...

Add web interface

Use Rocket to support http calls: REST interface and tiny HTML page that uses javascript to consume REST service.

Support ranges and vectors

[10, 20, 30] as well as [0..10] ( = [0,1,2,3,4,5,6,7,8,9]) and [0..10:2] ( = [0,2,4,6,8]) should denote a vector v.

v + 1 = [v0 + 1, v1 + 1, v2 + 1] etc.

Make output more detailed

Don't just display the debug representation of the interpreter result, but display numbers in appropriate format, e.g. for Integer:

10
Ah
1010b

Problem with `-` operator

- can be lexed as the start of a literal (-5 for example) and may also denote the subtraction operator. Which meaning is parsed depends on whitespace usage:

  • 5-5 is a parser error (atom atom where atom OP atom is expected)
  • 5 - 5 parses correctly as atom MINUS atom
    Fix this by introducing the unary negation operator - and removing the lexer ability to lex negative numbers.

Fix left assoc operators

All operators are now parsed as right-assoc with recursion. Migrate to loops for left-assoc operators. Test against 5 - 5 - 5, which should yield -5 but yields 5 as is.

Add more operators

Add the following operators:

  • bitwise or, and, xor, shift
  • exp, log, pow
  • sin, cos, tan, asin, acos, atan

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.