From d164fee8bf173d6adc5ae51d31f63c4faced53f9 Mon Sep 17 00:00:00 2001 From: Lukas Dresel Date: Tue, 30 Mar 2021 23:39:55 -0400 Subject: [PATCH 1/3] fixed wrong function in the tutorial --- docs/tutorial/01_language.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/01_language.rst b/docs/tutorial/01_language.rst index b1929a2..aef76ae 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" } From f586289d7d63d57fe9e87e7b9a3f72db8e383bd2 Mon Sep 17 00:00:00 2001 From: Lukas Dresel Date: Tue, 30 Mar 2021 23:48:15 -0400 Subject: [PATCH 2/3] fixed invalid s-expression example and fixed method calls --- docs/tutorial/01_language.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/01_language.rst b/docs/tutorial/01_language.rst index aef76ae..4faea7c 100644 --- a/docs/tutorial/01_language.rst +++ b/docs/tutorial/01_language.rst @@ -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). From f8c5c8356acb8142aad626ba7c24e4daa9531089 Mon Sep 17 00:00:00 2001 From: Lukas Dresel Date: Tue, 30 Mar 2021 23:49:08 -0400 Subject: [PATCH 3/3] fixed for new name --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 22c2ae7..a5b8d80 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Dev Environment Setup - 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