Giter Club home page Giter Club logo

rizzi's Introduction

This is an interpreter for (right now, a fragment of) the Rizzi programming language written in Go.

Syntactically, this is how the fragment works. Terminals are between '':

PROGRAM			-> MAIN '[' ID ']' STATEMENTLIST END

STATEMENTLIST   	-> STATEMENT STATEMENTLIST

STATEMENT		-> EXPR | ORDER | ASSIGNMENT

ASSIGNMENT		-> ID '=' EXPR

ORDER			-> 'if' EXPR 'then' STATEMENTLIST 'end' |

				'for' EXPR 'do' STATEMENTLIST 'end'
	   
EXPR			-> mathemathical expressions with +, *, -, integer /,

				rem, neg, succ, pred, exp, numbers and variables.
	   
ID			-> variable names

MAIN			-> 'main' | 'm'

END			-> 'end' | 'e'

Statements should be on separate lines. The parser works fine when that's the case but I'm not entirely sure why (which is pretty bad).

A program returns its last statement. Running the interpreter like "rizzi FILE -a ARG" passes ARG as an argument. That argument is saved in a variable with the name between '[' and ']'.

There's some syntactic bugs which restrict where we can put IDs. Right now they can be circumvented by writing '0 + var' instead of 'var' when a problem arises, but that's going to be fixed eventually. There's also syntactic bugs in the way we deal with parentheses.

#TODO (in order. FIFO):

  • Fix syntactic bugs on variables and parentheses.

  • Add a 'print' order.

  • Add multiple variables to programs.

  • Add a type system with:

  • Short-term:

    • i. Integers and natural numbers (i.e. unsigned integers) as distinct types.
    • ii. Type inference.
    • iii. Pairs with elements of arbitrary type.
  • Mid- and long-term:

    • iv. Lists (perhaps we can use pairs and pointers to pairs internally)
    • v. Bytes
    • vi. Structs
  • Perhaps:

    • vi. UTF-8 characters and UTF-8 strings.
  • Add function declarations and functions as first-class types.

  • Lexical scope.

  • The Go API.

rizzi's People

Contributors

iantayler avatar

Watchers

 avatar  avatar

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.