Git Product home page Git Product logo

jana's Introduction

Jana

An interpreter for Janus, the reversible programming language.

Build and Installation

To build Jana run

cabal configure
cabal build

and to install

cabal install

The program can also be run (assuming all dependencies are installed) by cd'ing to src and then running

runhaskell Main.hs

For more info about cabal see http://www.haskell.org/cabal/.

jana's People

Contributors

einar-io avatar kayloos avatar mbudde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jana's Issues

Run program from stdin

This would be quite handy for the web site so we doesn't need to write programs to temporary files.

Write email to Andrzej Filinski

Draft:

To: Andrzej Filinski [email protected]
Cc: Robert, Holger

Hi Andrzej

We're working with Robert and Holger on an interpreter for the Janus language as part of our Bachelor project. We have been informed that you manage the topps.diku.dk server and we have a couple of questions in regards to that:

  • Our interpreter is written in Haskell, so what version of Haskell is installed on the server? Would it perhaps be better to just install a precompiled binary on the server?
  • We need to make a web-page with an online interpreter similar to this one: http://topps.diku.dk/pirc/janus/. Are there any limitations to what language/framework we can use? We would prefer to use Ruby on Rails.

Regards,
Michael Budde and Claus Skou Nielsen

@kayloos: Any comments?

Bad error message when parsing main procedure fails

This program

procedure main()
    int foo[7

fails with the error message

(line 2, column 8):
unexpected reserved word "int"
expecting statement

The problem is that the parser uses try to parse the main function and when that fails, tries to parse it as a normal procedure.

Lvals in pop/push statements

Allow pop and push to/fom array entries, e.g.:

push(x[4], s)
pop(x[3], s)

Figure out if arbitrary expressions are allowed or if on constants should be allowed in the array lookup.

Allow creating local arrays with local/delocal

Currently the grammar only allows creating new variables of type int and stack but not arrays. Using the array initialization syntax from #11 it would look like:

local int foo[3] = {42, 12, 7}
    ...
delocal int foo[3] = {23, 5, 3}

Confusing error message for top

This program:

procedure main()
    int x
    x += top(1)

gives the very confusing error:

Error in line 3, column 14:
    Unexpected "1"
    Expecting statement

Fixed size integers

Fixed size integers should use modular arithmetic (v₁ ⊗ v₂ = ((v₁ ⊗ v₂) + 2³¹ mod 2³²) - 2³¹). It should be configurable if fixed size integers or arbitrary size integers should be used.

Add a testing framework

We should have a way to test the interpreter. I'm thinking we just start with a simple script that runs the interpreter on a program and checks the output. Then we can move on to a proper unit/property testing framework later.

Allow lvals in swap statement

Currently only identifiers are allowed. E.g. this should be possible:

x[0] <=> y

which is semantically equivalent to

x[0] ^= y
y    ^= x[0]
x[0] ^= y

It is also used by the factor example for Janus 1.0.

Bad error messages in parsing of assignment/swap

When there's an error in the left-hand side of an assignment or swap statement the error is a little confusing. E.g.

procedure main()
    x[#] += 5

give the error

File "tests/errors/parse-error-assign.ja" in line 2, column 7:
    Unexpected "#"
    Expecting statement

The problem is that the left-values are parsed wrapped in try so when they fail, parsing of the whole statement fails.

Check type/ident match in local/delocal

Currently local/delocal is not parsed in pairs, and the following is parsed ok:

local int foo = 0
local int bar = 0
...
delocal int foo = 0
delocal int bar = 0

Types are also not checked:

local int foo = 0
...
delocal stack foo = 0

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.