Skip to content
rework
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

README.md

About

ChopChop script is a scripting language for Haxe. It can interface with Haxe code using runtime reflection.

Usage

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 directory. This project also 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 download a pre-compiled version: https://github.com/Ohmnivore/ChopChopScript/releases

The language syntax is illustrated in the test suite directory (tests).

TODO

  • import functions from other chop scripts
  • enums
  • resolve packages for classes: new script.ast.AST("", []);
  • more 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

References

You can’t perform that action at this time.