
diff --git a/doc/Expr.adoc b/doc/Expr.adoc index 25c9fae..aaebff4 100644 --- a/doc/Expr.adoc +++ b/doc/Expr.adoc @@ -22,17 +22,23 @@ Expressions calculator toc::[] -#TODO: Work in progress (last update on 2024/05/09, 07:17 am)# +#TODO: Work in progress (last update on 2024/05/10, 06:52 a.m.)# == Expr _Expr_ is a GO package capable of analysing, interpreting and calculating expressions. +=== Concepts and terminology +#TODO# + +image::expression-diagram.png[] + === `dev-expr` test tool `dev-expr` is a simple program that can be used to evaluate expressions interactively. As its name suggests, it was created for testing purpose. In fact, beyond in additon to the automatic test suite based on the Go test framework, `dev-expr` provides an important aid for quickly testing of new features during their development. -It cat work as a REPL, *R*ead-*E*xecute-*P*rint-*L*oop, or it can process expression acquired from files or standard input. +It cat work as a _REPL_, _**R**ead-**E**xecute-**P**rint-**L**oop_, or it can process expression acquired from files or standard input. + +The program can be downloaded from https://git.portale-stac.it/go-pkg/-/packages/generic/dev-expr/[dev-expr]. -The program in located in the _tools_ directory. Here are some examples of execution. .Run `dev-expr` in REPL mode and ask for help @@ -103,11 +109,6 @@ Here are some examples of execution. <4> But operator, see <<_but_operator>>. <5> Multi-expression: the same result of the previous single expression but this it is obtained with two separated calculations. -=== Concepts and terminology -#TODO# - -image::expression-diagram.png[] - == Data types _Expr_ supports numerical, string, relational, boolean expressions, and mixed-type lists. diff --git a/doc/Expr.html b/doc/Expr.html index d0f9ed4..a2541e1 100644 --- a/doc/Expr.html +++ b/doc/Expr.html @@ -535,8 +535,8 @@ pre.rouge .ss {
TODO: Work in progress (last update on 2024/05/09, 07:17 am)
+TODO: Work in progress (last update on 2024/05/10, 06:52 a.m.)
Expr is a GO package capable of analysing, interpreting and calculating expressions.
+dev-expr
test tooldev-expr
is a simple program that can be used to evaluate expressions interactively. As its name suggests, it was created for testing purpose. In fact, beyond in additon to the automatic test suite based on the Go test framework, dev-expr
provides an important aid for quickly testing of new features during their development.
It cat work as a REPL, *R*ead-*E*xecute-*P*rint-*L*oop, or it can process expression acquired from files or standard input.
+It cat work as a REPL, Read-Execute-Print-Loop, or it can process expression acquired from files or standard input.
The program in located in the tools directory. -Here are some examples of execution.
+The program can be downloaded from dev-expr.
+Here are some examples of execution.
dev-expr
in REPL mode and ask for helpExpr also suports fractions. Fraction literals are made with tow integers separated by a vertical bar |
.
Expr also supports fractions. Fraction literals are made with two integers separated by a vertical bar |
.
>>>
1 | 2
1|2
>>>
4|6
-2|3
Fractions are always reduced to theri lowest terms
+2|3
Fractions are always reduced to their lowest terms
>>>
1|2 + 2|3
7|6
>>>
1|2 * 2|3
@@ -1003,7 +1005,7 @@ Here are some examples of execution.
Expr supports list of mixed-type values, also specified by normal expressions.
The items of array can be accessed using the dot .
operator.
<item> ::= <list-expr>"."<index-expr>
+`>>>` [blue]`[1,2,3].1`
+[green]`2`
+`>>>` [blue]`list=[1,2,3]; list.1`
+[green]`2`
+`>>>` [blue]`["one","two","three"].1`
+[green]`two`
+`>>>` [blue]`list=["one","two","three"]; list.(2-1)`
+[green]`two`
+`>>>` [blue]`list.(-1)`
+[green]`three`
+`>>>` [blue]`list.(-1)`
+[green]`three`
+`>>>` [blue]`list.(10)`
+=
must be an identifier.