Git Product home page Git Product logo

rs-pseudocode's Introduction

This project has been abandoned. A pseudocode interpreter is not viable, nor is it practical.

An interpreter for a statically typed language is not a good idea and is not an enjoyable experience to implement. An interpreter for pseudocode - a "language" that is supposed to be used to clarify logic or start designing an application should not have strict grammar checking or a mode of execution.

rs-pseudocode's People

Contributors

monofe avatar nouritsu avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

monofe

rs-pseudocode's Issues

Frontend: Implement a REPL

A REPL or a Read Execute Print Loop would allow users to execute small snippets of pseudocode.
The interpreter will run in REPL mode if no file is passed in.

It would be simplest to write the REPL manually.

Testing: Add tests for the Expression Parser

Tests should handle edge cases like -

  • chained operators
  • varying operator precedence
  • grouping expressions
  • invalid literals
  • invalid variable names
  • ... and more

The Cargo inbuilt test framework is perfect for this. There is no need to section tests off into a different folder as this is a small project.

Backend: Add more detailed variants to Expr enum

Currently the enum contains variants like -

Unary(Operator, Box<Expr>),
Binary(Box<Expr>, Operator, Box<Expr>),

The operator enum itself can be removed and the Expression Enum can instead contain variants -

Negate(Box<Expr>),
Not(Box<Expr>),
Multiply(Box<Expr>, Box<Expr>),
Divide(Box<Expr>, Box<Expr>)

This would make the evaluation process easier since the operator need not be matched against.

Bug: Keywords being parsed as identifiers

In code like -

5 + NOT

NOT is a keyword, not an identifier. The ident() parser should skip keywords.

List of keywords (maybe incomplete, will be edited) -

NOT, OR, AND, DIV, MOD,
IF, ELSE, ENDIF,
FOR, NEXT, ENDFOR,
WHILE, ENDWHILE,
PROCEDURE, ENDPROCEDURE,
FUNCTION, ENDFUNCTION, RETURNS,
CASE, ENDCASE,
ARRAY,
INTEGER, REAL, CHARACTER, STRING, DATE,

Rewrite: Parser using chumsky 1.0

There are various features in chumsky 1.0 that would allow the parser to be more readable, optimized and extendable.

Some functions need to be rewritten completely, while rewriting others would only serve to improve readability and speed.

Frontend: Integrate use of a Command Line Argument Parser

As the project grows, more flags would be made available. Flags like -

--debug / -d         : show debug information while interpreting
--help / -h          : show help text
--version / -v       : show current program version
--parse-only / -p    : only parse, do not interpret
--time / -t          : show time taken to parse and execute

One of the following crates should be used -

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.