Giter Club home page Giter Club logo

fimpp's Introduction

fimpp

FIM++ interpreter, released under GNU General Public License 3.

The project is no longer maintained. For a more recent version, see this fork: https://github.com/avian2/fimpp

Inspired by this Equestria Daily post and this DeviantArt sample program and some comments below it.

FIM++ is imperative, dynamically-typed, interpreted language. Currently, it supports integer arithmetic, console output, dynamically growing arrays, and subroutines.

FIM++ can use Java classes, which opens it to the rich and wide JVM ecosystem. Also, it makes it possible to write a simple GUI program using Swing.

Running

In the bin directory, there are all necessary JARs and scripts to run this interpreter on any machine with Java installed. Know that the fimpp.jar in that directory might lag behind the actual interpreter sources, so you might want to compile the interpreter yourself.

Anyway, to run the interpreter with given FIM++ source file from your command line, assuming that the bin directory is in your PATH environment variable:

$ fimpp <FIM++ script file> 

Compilation

You will need Scala compiler from Scala's website and JDK.

The easiest way is to use the provided makefile:

$ make

And that's all! A freshly compiled JAR lands in your bin directory!

If you want to compile it manually (e.g. no make on your system), follow these steps:

$ mkdir target
$ scalac -d target src/stasiak/karol/fimpp/*
$ cd target
$ jar cfe ../bin/fimpp.jar stasiak.karol.fimpp.Main stasiak

(By the way, the steps above should also work on Windows.)

Examples

See examples directory

FIM++ Syntax

See syntax directory.

fimpp's People

Stargazers

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

Watchers

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

fimpp's Issues

Compiler doesn't work when built from scala source.

The supplied jar works. But if I make a new one with make, and then try to interpret some example, I get:

parsing: examples/fibonacci.fimpp
Exception in thread "main" java.lang.NoSuchMethodError: scala.util.parsing.combinator.Parsers$class.lastNoSuccess_$eq(Lscala/util/parsing/combinator/Parsers;Lscala/util/parsing/combinator/Parsers$NoSuccess;)V
    at stasiak.karol.fimpp.FimppParser$.lastNoSuccess_$eq(FimppParser.scala:5)
    at scala.util.parsing.combinator.Parsers$class.$init$(Parsers.scala:151)
    at stasiak.karol.fimpp.FimppParser$.<init>(FimppParser.scala:5)
    at stasiak.karol.fimpp.FimppParser$.<clinit>(FimppParser.scala)
    at stasiak.karol.fimpp.Main$.main(Main.scala:22)
    at stasiak.karol.fimpp.Main.main(Main.scala)

For reference, this is the output of make:

src/stasiak/karol/fimpp/FimppParser.scala:334: warning: match may not be exhaustive.
It would fail on the following input: Error(_, _)
    parseAll(module,s) match {
            ^
warning: there were 2 feature warnings; re-run with -feature for details
two warnings found
cd target && jar cfe ../bin/fimpp.jar stasiak.karol.fimpp.Main stasiak

Main class missing?

Error: Could not find or load main class stasiak.karol.fimpp.main

Not sure if it is my fault, or a code error, or what. I have the newest JDK, recompiled from scala, ran straight out of the box, compiled into new jars twice, and everything. Not sure exactly whats going on. Is something mislabeled in the code or am I completely missing something?

"and" in conditional expressions confused with tuple syntax.

Conjuctions don't work well because the parser confuses the word and with the syntax for tuples.

For instance, this works with or:

Applejack has more than one or Pinkie Pie has more than one

[1.60] parsed: Alternative(
  List(
    Relational(
      VariableValue(applejack),>,NumberValue(1)
    ), 
    Relational(
      VariableValue(pinkie pie),>,NumberValue(1)
    )
  )
)

However, replacing or with and:

Applejack has more than one and Pinkie Pie has more than one

[1.47] failure: ‘Has’ ain't no pony I've heard of. Do they have tea parties with ‘Has’?

The source of the problem is that the parser attempts to make a tuple from one and Pinkie Pie has ..., which in turn attempts to make an identifier from Pinkie Pie has .... This then fails here because has is a keyword.

I think ^? combinator is not the right approach here. The check for keywords should make the parser backtrack instead of failing.

Scala version 2.11 requires scala-parser-combinators

If one updates both Scala and Java to compile, the later version of scala will require both building and running linked to the scala-parser-combinators jar file. I am not sure what the solution should be. My suggestions would be either a version requirement or version checking in the makefile.

Words that should work not working.

I'm trying to write the Fibonacci sequence in FiM++, but I get strange errors, to the point where I can't even use the syntax in the syntax folder anymore!
Example:
Rarity's Gems now becomes add Rarity's Gems and Spike's Hoard.

It claims that 'and' is not recognized, and the phrase:
Rarity's Gems now becomes Rarity's Gems plus Spike's Hoard.

Throws from the RegEx saying it was looking for 'got' but found '." (period) instead...

Am I just doing this all wrong, or is this more WiP than I though?

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.