From d0666bd369f551de3e5d843a09bab78754c0d70e Mon Sep 17 00:00:00 2001 From: nsensfel Date: Wed, 9 Oct 2019 11:44:25 +0200 Subject: Moves the optimization functions out. --- include/ataxia/ataxic.hrl | 53 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 include/ataxia/ataxic.hrl (limited to 'include') diff --git a/include/ataxia/ataxic.hrl b/include/ataxia/ataxic.hrl new file mode 100644 index 0000000..cea5819 --- /dev/null +++ b/include/ataxia/ataxic.hrl @@ -0,0 +1,53 @@ +%%%% Select +-record(field, {ix :: non_neg_integer(), op :: basic()}). +-record(upfield, {ix :: non_neg_integer(), op :: basic()}). + +%%%% Sequence of instructions +-record(seq, {ops :: list(basic())}). + +%%%% Values Access +-record(const, {value :: any()}). +-record(current, {}). + +% Possible improvement: add support for some sort of registers. +% This would add a dict (no need for orddict here) when evaluating Ataxic +% expressions, with the following functions: +% -record(reg_store, {name :: binary(), op :: basic()}). +% -record(reg_load, {name :: binary()}). +% It's kind of weird to use though, cause you can't retrieve what you've stored +% at a node that was deeper in the query's tree. It can be used to move values +% further down (or horizontally) though, and there are already instructions that +% give you values found further down. + +-record +( + apply_fun, + { + module :: atom(), + function :: atom(), + params :: list(basic()) + } +). + +%%%% Number Comparison +-record(gt, {p0 :: basic(), p1 :: basic()}). +-record(ge, {p0 :: basic(), p1 :: basic()}). +-record(lt, {p0 :: basic(), p1 :: basic()}). +-record(le, {p0 :: basic(), p1 :: basic()}). +-record(eq, {p0 :: basic(), p1 :: basic()}). + +%%%% Bool Operations +-record(land, {params :: list(basic())}). +-record(lor, {params :: list(basic())}). +-record(neg, {param :: basic()}). + +-record(list_cons, {param :: basic()}). + +%%%% META OP %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% Select +-record(read_perm, {op :: basic()}). +-record(write_perm, {op :: basic()}). +-record(lock, {op :: basic()}). +-record(value, {op :: basic()}). + +-record(mseq, {ops :: list(meta())}). -- cgit v1.2.3-70-g09d2