Giter Club home page Giter Club logo

omgrofl-interpreter's Introduction

Omgrofl-interpteter

Omgrofl interpreter with JIT support

About

This project aims to create a fully-functional interpreter of an esoteric programming language called Omgrofl. More information on the language itself can be found here: http://esolangs.org/wiki/Omgrofl

Suggestions or patches are more than welcome.

How it works

The interpreter parses the input source code and transforms it into an abstract syntax tree and then executes it. The syntax tree can be interpreted directly or JIT compilation into JVM bytecode can be used.

Currently supported statements

  • Assignment (variable iz variable/value; variable to /dev/null)
  • Char output (rofl variable)
  • Char input (stfw variable)
  • Infinite loop (rtfm ... brb)
  • Loop break (tldr)
  • Comments (w00t)
  • Sleep (afk variable/value)
  • Program exit (stfu)
  • Incrementing / decrementing (lmao/roflmao variable)
  • Conditions (wtf variable/value iz (nope) liek/uber variable/value ... brb)
  • Stack/Queue (n00b/l33t/haxor variable)

Implementation details

  • Unassigned variables are treated as nonexistent. If you try to use a variable without assigning a value to it first, an exception will be thrown.
  • An exception will also be thrown if you try to take a value off the stack when the stack is empty.
  • On EOF, 255 is returned as the value.
  • JIT may or may not be faster than interpreting Omgrofl directly. It will definitely be faster if the program is long and resource-intensive.
  • Indentation and whitespace don't matter. The only thing that matters is that every statement is written on a separate line.
  • If there is more than one statement on a line, an exception will be thrown. This doesn't follow the language specification, but I believe this is a good decision, because a) honest mistakes will be found faster, and b) people new to the language will know if they've written anything wrong.

License

MIT (see LICENSE)

omgrofl-interpreter's People

Watchers

James Cloos avatar Octavia Togami 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.