Giter Club home page Giter Club logo

chopchopscript's Introduction

What is this?

ChopChop script is a script language for Haxe that is focused on speed. It expects that you have already declared all necessary methods and classes in your Haxe code, so all it needs to do is call them.

How to use

var script:String = sys.io.File.getContent(path);
var lexer:ScriptLexer = new ScriptLexer(script);
var parser:ScriptParser = new ScriptParser(lexer);
var interp:ScriptInterp = new ScriptInterp();
trace(interp.interpret(parser.parse()));

For your own purposes you only need the src/script folder. However, this project builds into an interpreter with the following usage:

Usage: ChopChop Interpreter
[source] -> the file to interpret -> expects: [path]
-[test] (-t) -> run tests and exit -> expects: []
ex: chopchop.exe test.cpcp
ex: chopchop.exe -t

You can get a pre-compiled version here: https://github.com/Ohmnivore/ChopChopScript/releases

Why?

Of course half of this is just me fooling around, but the main idea is to provide a scripting tool for Haxe with the best performance possible. I'm planning on using benchmarks to compare it to hscript, which seems to be the only alternative so far, and then to a Haxe equivalent of the test scripts.

I plan to maybe use this for a plugin system in one of my games.

It was inspired by Nico's VainLang and the hscript project.

TODO

  • import functions from other chop scripts
  • enums
  • resolve packages for classes: new script.ast.AST("", []);
  • robust syntax error reporting (match->[throw error if not expected token] instead of consume)
  • turn inNest into an inObject bool

Notes

  • enums are WIP
  • Do while loop syntax: do while (CONDITION) {STATEMENTS}
  • No ++ or -- operator
  • No shorthand blocks: if (true) x = 10;
  • No type checking
  • No ... operator aka no for (0...10) style loops
  • No class definitions
  • No ternary operator (?:)
  • No string interpolation
  • No array or iterator comprehension (aka [while (i < 10) i++] && for (while (i < 10) i++))
  • No conditional compilation
  • No macros
  • No switches
  • No pattern matching
  • No need for type casting

REF

chopchopscript's People

Contributors

ohmnivore 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.