added README.md

This commit is contained in:
Nicolas Cannasse
2013-06-07 22:37:30 +02:00
parent 830b0d477b
commit 20da568b4a
2 changed files with 34 additions and 1 deletions
+33
View File
@@ -0,0 +1,33 @@
hscript
=======
Parse and evalutate Haxe expressions.
Usage :
```haxe
var expr = "var x = 4; 1 + 2 * x";
var parser = new hscript.Parser();
var ast = parser.parseString(expr);
var interp = new hscript.Interp();
trace(interp.execute(ast));
```
In case or parse or runtime error an `hscript.Expr.Error` is throwed. You can use `parser.line` to know the line number.
You can set some globaly accessible identifiers by using `interp.variables.set("name",value)`
Advanced Usage
--------------
When compiled with `-D hscriptPos` you will get fine error reporting at parsing time.
You can subclass `hscript.Interp` to override behaviors for `get`, `set`, `call`, `fcall` and `cnew` behaviors.
You can add more binary and unary operations to the parser by setting `opPriority`, `opRightAssoc` and `unops` content.
You can use `parser.allowJSON` to allow JSON data.
You can use `parser.allowTypes` to parse types for local vars, exceptions, function args and return types. Types are ignored by the interpreter.
You can use `new hscript.Macro(pos).convert(ast)` to convert an hscript AST to a Haxe macros one.
+1 -1
View File
@@ -1,7 +1,7 @@
@echo off
rm -rf release
mkdir release
cp haxelib.json release
cp haxelib.json README.md release
cd release
mkdir hscript
cd ..