From 04ee7f151f4bc7cfcff38d87c0b44ad5ff648ca7 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Sun, 3 Nov 2019 12:20:26 +0100 Subject: [PATCH] update documentation --- docs/userGuide/userDocGen.sh | 4 +-- docs/userGuide/userGuide.tex | 63 +++++++++++++++++++++++++++++++++--- 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/docs/userGuide/userDocGen.sh b/docs/userGuide/userDocGen.sh index 2366931c3f..b6500936de 100755 --- a/docs/userGuide/userDocGen.sh +++ b/docs/userGuide/userDocGen.sh @@ -22,12 +22,12 @@ for key in ${!arr[@]}; do echo '\section{'${arr[${key}]}'}' echo "$key" | tr ',' '\n' | while read group do - ../../debug/aql2/aql2 -q 'introspect algorithms '"$group"'::' | sed 's/<object::Object>//g' | while read algorithm + ../../debug/aql2/aql2 -c 'introspect algorithms '"$group"'::' | sed 's/<object::Object>//g' | while read algorithm do echo "$algorithm" | sed 's/_/\\_/g' echo echo '\begin{lstlisting}' - ../../debug/aql2/aql2 -q 'introspect overloads '"$algorithm" | sed 's/ >/>/g' | sed 's/std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>/std::string/g' | sed 's/, ext::less<void>//g' | sed 's/, std::allocator<object::Object>//g' | sed 's/, std::allocator<ext::pair<object::Object, object::Object>>//g' | sed 's/, std::allocator<unsigned int>//g' | sed 's/, std::allocator<unsigned long>//g' | sed 's/, std::allocator<int>//g' | sed 's/, std::allocator<std::pair<object::Object const, unsigned long>>//g' | sed 's/, std::allocator<common::ranked_symbol<object::Object, unsigned int>>//g' | sed 's/, std::allocator<std::pair<object::Object const, object::Object>>//g' | sed 's/, std::allocator<std::pair<common::ranked_symbol<object::Object, unsigned int> const, unsigned long>>//g' | sed 's/, std::allocator<std::pair<node::Node const, int>>//g' | sed 's/, std::allocator<ext::pair<long, long>>//g' | sed 's/, std::allocator<std::pair<object::Object const, double>>//g' | sed 's/, std::allocator<std::pair<ext::pair<long, long> const, double>>//g' | sed 's/, std::allocator<std::pair<object::Object const, ext::map<object::Object, double>>>//g' | sed 's/, std::allocator<std::pair<node::Node const, ext::unordered_map<node::Node, int, std::hash<node::Node>, std::equal_to<node::Node>>>>//g' | sed 's/, std::allocator<std::pair<node::Node, node::Node>>//g' | sed 's/, std::allocator<std::pair<ext::pair<long, long> const, ext::map<ext::pair<long, long>, double>>>//g' | sed 's/, std::allocator<ext::variant<object::Object, object::Object>>//g' | sed 's/, std::allocator<ext::variant<object::Object, object::Object>>//g' | sed 's/, std::allocator<ext::vector<ext::variant<object::Object, object::Object>>>//g' | sed 's/, std::allocator<sax::Token>//g' | sed 's/, std::allocator<std::pair<std::pair<object::Object, object::Object> const, ext::map<object::Object, object::Object>>>//g' | sed 's/, std::allocator<std::pair<object::Object const, ext::set<ext::vector<ext::variant<object::Object, object::Object>>>>>//g' | sed 's/, std::allocator<ext::set<object::Object>>//g' | sed 's/, std::allocator<ext::map<std::pair<object::Object, object::Object>, ext::map<object::Object, object::Object>>>//g' | sed 's/, std::allocator<ext::vector<ext::set<object::Object>>>//g' | sed 's/, std::hash<node::Node>, std::equal_to<node::Node>//g' | sed 's/, std::allocator<string::LinearString<object::Object>>//g' | sed 's/, std::hash<std::pair<node::Node, node::Node>>, std::equal_to<std::pair<node::Node, node::Node>>//g' + ../../debug/aql2/aql2 -c 'introspect overloads '"$algorithm" | sed 's/ >/>/g' | sed 's/std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>/std::string/g' | sed 's/, ext::less<void>//g' | sed 's/, std::allocator<object::Object>//g' | sed 's/, std::allocator<ext::pair<object::Object, object::Object>>//g' | sed 's/, std::allocator<unsigned int>//g' | sed 's/, std::allocator<unsigned long>//g' | sed 's/, std::allocator<int>//g' | sed 's/, std::allocator<std::pair<object::Object const, unsigned long>>//g' | sed 's/, std::allocator<common::ranked_symbol<object::Object, unsigned int>>//g' | sed 's/, std::allocator<std::pair<object::Object const, object::Object>>//g' | sed 's/, std::allocator<std::pair<common::ranked_symbol<object::Object, unsigned int> const, unsigned long>>//g' | sed 's/, std::allocator<std::pair<node::Node const, int>>//g' | sed 's/, std::allocator<ext::pair<long, long>>//g' | sed 's/, std::allocator<std::pair<object::Object const, double>>//g' | sed 's/, std::allocator<std::pair<ext::pair<long, long> const, double>>//g' | sed 's/, std::allocator<std::pair<object::Object const, ext::map<object::Object, double>>>//g' | sed 's/, std::allocator<std::pair<node::Node const, ext::unordered_map<node::Node, int, std::hash<node::Node>, std::equal_to<node::Node>>>>//g' | sed 's/, std::allocator<std::pair<node::Node, node::Node>>//g' | sed 's/, std::allocator<std::pair<ext::pair<long, long> const, ext::map<ext::pair<long, long>, double>>>//g' | sed 's/, std::allocator<ext::variant<object::Object, object::Object>>//g' | sed 's/, std::allocator<ext::variant<object::Object, object::Object>>//g' | sed 's/, std::allocator<ext::vector<ext::variant<object::Object, object::Object>>>//g' | sed 's/, std::allocator<sax::Token>//g' | sed 's/, std::allocator<std::pair<std::pair<object::Object, object::Object> const, ext::map<object::Object, object::Object>>>//g' | sed 's/, std::allocator<std::pair<object::Object const, ext::set<ext::vector<ext::variant<object::Object, object::Object>>>>>//g' | sed 's/, std::allocator<ext::set<object::Object>>//g' | sed 's/, std::allocator<ext::map<std::pair<object::Object, object::Object>, ext::map<object::Object, object::Object>>>//g' | sed 's/, std::allocator<ext::vector<ext::set<object::Object>>>//g' | sed 's/, std::hash<node::Node>, std::equal_to<node::Node>//g' | sed 's/, std::allocator<string::LinearString<object::Object>>//g' | sed 's/, std::hash<std::pair<node::Node, node::Node>>, std::equal_to<std::pair<node::Node, node::Node>>//g' echo '\end{lstlisting}' done done diff --git a/docs/userGuide/userGuide.tex b/docs/userGuide/userGuide.tex index 0902abca0b..95e4656b3f 100644 --- a/docs/userGuide/userGuide.tex +++ b/docs/userGuide/userGuide.tex @@ -625,9 +625,25 @@ It is also possible to use gui. Use the following command extra/docker/docker-ag This chapter mostly focuses on the description of the current status of the command line interface so-called aql. The command line interface was created to replace the interface represented by multiple binaries. The command line interface uses the abstraction module and registered algorithms. The algorithms are available to be called with appropriate arguments. The language of the command line interface is similar to bash, featuring subqueries and pipes. +\section{Execution parameters} + +The query language shell binary accepts the following parameters: +\begin{description} + \item [-c] allows execution of a single command + \item [-f] executes commands from a file + \item [-e] sets an enviroment variable + \item [-i] open interactive mode +\end{description} + +The default behavior of the shell binary is to open the interactive mode. The default behavior is disabled if any of -c or -f is specifies. The shell binary will stay in interactive mode if -i is used with -c or -f parameter. + +The -c, -f and -i parameters are executed in order of apperance. The environment variables are set up before any command is executed. + +Any quit command executed from parameter, a file, or from interactive shell stops the complete sequence of execution plan. + \section{Language description} -The language is described by syntax similar to EBNF. The grammar's initial symbol is 'parse'. The terminal symbols are in uppercase, nonterminals in lowercase. The terminal symbols starting with KW_ prefix represent nonreserved keywords of values equal to what is after the underscore. Integer is a sequence of digits; identifier is a letter followed by letters and digits and string is double-quoted character sequence. The terminal symbol end is a special terminal symbol representing the end of the input. +The language is described by syntax similar to EBNF. The grammar's initial symbol is 'parse'. The terminal symbols are in uppercase, nonterminals in lowercase. The terminal symbols starting with KW\_ prefix represent nonreserved keywords of values equal to what is after the underscore. Integer is a sequence of digits; identifier is a letter followed by letters and digits and string is double-quoted character sequence. The terminal symbol end is a special terminal symbol representing the end of the input. \begin{lstlisting} arg @@ -890,17 +906,56 @@ execute cli::builtin::ReadFile ../examples2/automaton/DFA.txt | string::Parse @ \section{Command line execution} \begin{lstlisting} -./aql2 -p input=../examples2/automaton/DFA.txt -q 'execute cli::builtin::ReadFile #input# > $in' -q 'execute string::Parse @ automaton::Automaton ^ $in' +./aql2 -e input=../examples2/automaton/DFA.txt -c 'execute cli::builtin::ReadFile #input# > $in' -c 'execute string::Parse @ automaton::Automaton ^ $in' \end{lstlisting} \noindent \begin{lstlisting} -./aql2 -q 'execute automaton::simplify::efficient::EpsilonRemoverIncoming <#stdin | automaton::determinize::Determinize - | automaton::simplify::Trim - | automaton::simplify::Minimize - | automaton::simplify::Normalize - > #stdout' +./aql2 -c 'execute automaton::simplify::efficient::EpsilonRemoverIncoming <#stdin | automaton::determinize::Determinize - | automaton::simplify::Trim - | automaton::simplify::Minimize - | automaton::simplify::Normalize - > #stdout' \end{lstlisting} \noindent \begin{lstlisting} -echo 'a + a' | ./aql2 -q 'execute cli::builtin::ReadFile \#stdin | string::Parse @ regexp::RegExp ^ - | regexp::convert::ToAutomatonGlushkov (UnboundedRegExp) -' +echo 'a + a' | ./aql2 -c 'execute cli::builtin::ReadFile \#stdin | string::Parse @ regexp::RegExp ^ - | regexp::convert::ToAutomatonGlushkov (UnboundedRegExp) -' +\end{lstlisting} + + +\section{Execution parameters} + +test.aql: +\begin{lstlisting} +execute string::Parse @Automaton " +DFA 0 1 +<>0 0 0" > $dfa +execute "f1" +execute "f2" +\end{lstlisting} + +\begin{lstlisting} +$ aql2 -c "execute 1" -c "execute 2" -f test.aql ; echo "retval -> $?" +1 +2 +f1 +f2 +retval -> 0 +\end{lstlisting} + +\begin{lstlisting} +$ aql2 -c "execute 1" -c "execute 2" -f test.aql -i ; echo "retval -> $?" +1 +2 +f1 +f2 +> execute "i" +i +> <EOF> +retval -> 0 +\end{lstlisting} + +\begin{lstlisting} +$ aql2 -c "execute 1" -c "quit 55" -f test.aql -i ; echo "retval -> $?" +1 +retval -> 55 \end{lstlisting} \backmatter -- GitLab