GithubHelp home page GithubHelp logo

josh-dev-things / good-soldier Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 182 KB

An Imperative, Error-Tolerant, Interpreted Programming Language.

Java 100.00%
interpreter programming-language java good-soldier-script

good-soldier's Introduction

Good Soldier : An Imperative, Error-Tolerant, Interpreted Programming Language.

About

Good Soldier Script (.goss) is a humble programming language with the following features:

  • Weak Typing (Barely any typing at all)
  • Low-level programming workflow (Despite being interpreted in Java)
  • Slow execution (Probably, I haven't checked yet)
  • Error-Tolerance (Will always fully interpret. Regardless of any runtime errors, the script will all be executed and interpreting won't halt)
  • Surprises (Oodles of undefined behaviour)

The language is still under development and should, under no circumstances, be used for anything more than a bit of fun. The benchmark for the language was initially to solve a few Project Euler problems, but as it is developed further and more data-types and different functionalities are added, perhaps its usage scope will grow.


Installation

  1. Download the repository as a .zip file or fork the repository and clone it locally.
  2. Go to the root of the directory and then compile the Interpreter.java file.
  3. Example .goss files are in the Examples/ directory.
  4. Write your own .goss, then interpret it by passing its path as a command-line argument to the interpreter.

Documentation

Does not exist yet.

See Parser.tokenMapping for token regex definitions. See Examples/ for some usage. If unsure about particular functionality, it probably doesn't exist. In which case please implement it and contribute!


Grammar

Rudimentary Context-Free Grammar for Good Soldier Script:

procedure -> open expression* close

open -> "START" ("<-" args)?
close -> "END" ("->" args)?
args -> "["value ("," value)*"]"

expression -> tokenC | ε
tokenC -> tag | io | jump | assignment
assignment -> var "=" value
value -> var | computation | numeric | string | boolean
var -> "_*[a-zA-Z]([a-zA-Z]*[0-9]*)*"

computation -> value operator value
operator -> nOperator | sOperator | bOperator
nOperator -> "+|-|/|*|%|==|>=|<=|!="
sOperator -> "s+"|"s="|"s!="
bOperator -> "&" | "|" | "^"
numeric -> "[0-9]+(\.[0-9]+)?"
string -> "\".\""
boolean -> "TRUE" | "FALSE"

tag -> var ":"
jump -> "jump" var | "jump?" (boolean | var) var

io -> in | out
in -> "in" var
out -> "out" var

Contribution

While the language is evidently in its infancy, I've made it public so that other 1st and 2nd year students at my university can contribute to it and investigate writing a parser themselves. If you'd like to contribute, please fork the repository, make your additions and then create a pull request.

Atomic, specific and well-integrated commits are likely to get merged.

We're looking for people to help with:

  • Documentation
  • Formally, well-defined grammar for the language
  • Programming the interpreter
  • Designing functionality
  • Making coffee
  • Writing examples
  • Testing

If you are a Java verteran or a senior honours student at the university, this project is likely not going to be a valuable use of your time. 1st and 2nd years should consider contributing!


License

License: MIT Published under the MIT license.


Attributions

A language by Joshua James-Lee.

Language name inspired by The Good Soldier Svejk by Jaroslav Hašek.

good-soldier's People

Contributors

josh-dev-things avatar

Stargazers

 avatar

Watchers

 avatar

good-soldier's Issues

Variable Values Padded With "

When the "in" keyword receives a string, the result is padded with quotation marks, even if the input is an integer. Comparisons and operations therefore have to manually remove the " to work. Unwieldy. Fix!

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.