diff --git a/README.md b/README.md index 22c2ae7..e039092 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,18 @@ Dev Environment Setup ===================== - Prerequisite: - python 3.6+ + - R - It is preferable to have a dedicated virtualenv for this project: ``` $ git clone - $ cd Tyrell + $ cd Trinity $ mkdir venv $ python3 -m venv venv $ source venv/bin/activate ``` - Make an editable install with `pip`. This would automatically handles package dependencies. One of our dependency, `z3-solver`, takes a long time to build. Please be patient. ``` + $ pip install wheel $ pip install -e ".[dev]" $ python setup.py sdist # for package ``` diff --git a/docs/tutorial/01_language.rst b/docs/tutorial/01_language.rst index b1929a2..4faea7c 100644 --- a/docs/tutorial/01_language.rst +++ b/docs/tutorial/01_language.rst @@ -94,7 +94,7 @@ The :func:`~tyrell.spec.do_parse.parse_file` function takes file path as a param .. code-block:: python from tyrell.spec import parse - spec = parse_file(r''' + spec = parse(r''' enum IntConst { "0", "1", "2" } @@ -176,9 +176,9 @@ For example, a simple interpreter for the small language we defined in the previ # Create the interpreter object and run it interp = BinaryArithFuncInterpreter() - print(interp.eval(builder.from_sexp_string('(@param 0)', [3, 4]))) # Prints 0 - print(interp.eval(builder.from_sexp_string('(const (IntConst 1))', [3, 4]))) # Prints 0 - print(interp.eval(builder.from_sexp_string('(plus (@param 1) (IntConst 2))', [3, 4]))) # Prints 0 + print(interp.eval(builder.from_sexp_string('(@param 0)'), [3, 4])) # Prints 0 + print(interp.eval(builder.from_sexp_string('(const (IntConst 1))'), [3, 4])) # Prints 0 + print(interp.eval(builder.from_sexp_string('(plus (@param 1) (const (IntConst 2)))'), [3, 4])) # Prints 0 Well, this is not a super interesting interpreter, as it interprets any program to ``0``. To make it more interesting, we could have examined what the structure of ``node`` is, and take different actions according to whether it's a parameter, an enum, or a function application (in which case you may need to recurse down and interpret its arguments).