Skip to content
Snippets Groups Projects
Commit 4ca969bd authored by Jan Trávníček's avatar Jan Trávníček
Browse files

update documentation

parent f4ffb11b
No related branches found
No related tags found
1 merge request!123Merge jt
Pipeline #61290 failed
......@@ -677,9 +677,18 @@ in_redirect
| in_redirect_file
;
 
out_redirect_file
: ( LEFT_BRACKET arg RIGHT_BRACKET )? file
;
out_redirect
: DOLAR_SIGN arg
| out_redirect_file
;
common
: DOLAR_SIGN arg
| IN_REDIRECT in_redirect
| LESS_SIGN in_redirect
| STRING
| INTEGER
| HASH_SIGN ( INTEGER | IDENTIFIER )
......@@ -700,21 +709,7 @@ statement
;
 
statement_list
: statement ( PIPE_SIGN statement )*
;
out_redirect_file
: ( LEFT_BRACKET arg RIGHT_BRACKET )? file
;
out_redirect
: DOLAR_SIGN arg
|
| out_redirect_file
;
result
| out_redirect
: statement ( PIPE_SIGN statement | MORE_SIGN out_redirect )*
;
 
introspect_cast_from_to
......@@ -731,7 +726,8 @@ introspect_command
;
 
command
: EXECUTE statement_list result
: EXECUTE statement_list
| PRINT statement_list
| QUIT statement_list?
| EXIT statement_list?
| HELP arg?
......@@ -778,25 +774,25 @@ introspect bindings
 
\subsection{Execute}
 
The execute command is intended to execute a sequence of statemets. Statements are vertical bar separated algorithms introduced by the name, casts to specified type, or one can use a variable, file, string or integer constant, binded value, or set constructor. (The set constructor will in the future acompanied with constructor of other common structures.)
The execute and print commands are intended to evaluate a sequence of statemets. Statements are vertical bar separated algorithms introduced by the name, casts to specified type, or one can use a variable, file, string or integer constant, binded value, or set constructor. (The set constructor will in the future acompanied with constructor of other common structures.)
 
The syntax of execute comand is similar to the syntax of bash. In the simple case the sequence of statements is simply a sequence of algorithms and their parameters.
The syntax of execute and print comands is similar to the syntax of bash. In the simple case the sequence of statements is simply a sequence of algorithms and their parameters.
 
\begin{lstlisting}
execute string::Parse @Automaton "NFA a b
print string::Parse @Automaton "NFA a b
>0 0 1
1 - 2
<2 - -" | Determinize -
\end{lstlisting}
 
Result of a execute command will be printed to the console by default, but it can also be printed to a file and later read.
Result of a print command will be printed to the console, but result of execution can also be printed to a file and later read.
 
\begin{lstlisting}
execute string::Parse @Automaton "NFA a b
>0 0 1
1 - 2
<2 - -" | Determinize - > automaton.xml
execute < automaton.xml | Minimize -
print < automaton.xml | Minimize -
\end{lstlisting}
 
File reading is parametrized by some clauses, the argument inside the brackets is a specification of the file type, the argument after the colon is the specification of the content of the file, and arguments after at sign give template parameters is needed.
......@@ -807,13 +803,13 @@ The string and raw types require the content specification to be set with type a
 
\begin{lstlisting}
execute "abc" | cli::builtin::WriteFile "file.txt" -
execute < [ raw ] :string::LinearString file.txt
print < [ raw ] :string::LinearString file.txt
\end{lstlisting}
 
The use of the in\_redirect symbol is overloaded and allows the creation of subquery.
 
\begin{lstlisting}
execute Determinize <( string::Parse @Automaton "NFA a b
print Determinize <( string::Parse @Automaton "NFA a b
>0 0 1
1 - 2
<2 - -")
......@@ -835,13 +831,7 @@ execute Determinize <( string::Parse @Automaton "NFA a b
>0 0 1
1 - 2
<2 - -" ) > \$dfa
execute Minimize \$dfa
\end{lstlisting}
Specifying no target file in the output redirection discarts the result.
\begin{lstlisting}
execute < automaton.xml >
print Minimize \$dfa
\end{lstlisting}
 
The command line interface can be exited with quit command that can also report exit status of the execution. The syntax of the quit is same as execute in that case, however only integer and boolean results are interpreted as exit status. Integer result is used directly, boolean value true is interpretted as 0 exit status and false as 1. The behavior matches the expected results of commands in unix like systems.
......@@ -927,12 +917,12 @@ test.aql:
execute string::Parse @Automaton "
DFA 0 1
<>0 0 0" > $dfa
execute "f1"
execute "f2"
print "f1"
print "f2"
\end{lstlisting}
 
\begin{lstlisting}
$ aql2 -c "execute 1" -c "execute 2" -f test.aql ; echo "retval -> $?"
$ aql2 -c "print 1" -c "print 2" -f test.aql ; echo "retval -> $?"
1
2
f1
......@@ -941,19 +931,19 @@ retval -> 0
\end{lstlisting}
 
\begin{lstlisting}
$ aql2 -c "execute 1" -c "execute 2" -f test.aql -i ; echo "retval -> $?"
$ aql2 -c "print 1" -c "print 2" -f test.aql -i ; echo "retval -> $?"
1
2
f1
f2
> execute "i"
> print "i"
i
> <EOF>
retval -> 0
\end{lstlisting}
 
\begin{lstlisting}
$ aql2 -c "execute 1" -c "quit 55" -f test.aql -i ; echo "retval -> $?"
$ aql2 -c "print 1" -c "quit 55" -f test.aql -i ; echo "retval -> $?"
1
retval -> 55
\end{lstlisting}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment