You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This document gathers limitations of our current AST which mainly became apparent while building the Python frontend. Some duplicates with #36 may exist.
Multi-Return Values / Multi-Assignment
What?
The following (Python) syntax is not supported in our AST:
Something similar is supported though: return values can be ExpressionLists, which contain (a fixed number of) entries of the same type. However, there is no multi-assignment. In fact, those vectors are never changed in size and we always operate on the full vector. All variables are vectors. Thus, assigning variables to parts of the vector is not (straightforward) to support.
Why is this useful?
To efficiently translate higher level languages as Python to our framework.
Type Casting
We do not support type casting yet. I.e., double * int will result in an error and not implicitly cast the int to a double. A real intermediate representation should solve such issues.
No Break Statement / No While Loop
There is no break statement for for-loops. This is an issue for the Python frontend, since Python has limited for-loops. Instead, we often use while-loops to express things.
But without break, some while loops cannot easily be translated, e.g.
i=1whileTrue:
i+=iifi>100:
break
because here, we do an update before checking the condition. This is not the same as
inti;
for (i=1; i>100; i+=i);
E.g., when we initialize i to 100, the first results in i = 200, the second in i = 100. Detecting how to transform those loops doesn't seem trivial.
Of course, this is only translatable to FHE if i is a non-secret value. We could emulate while loops with for loops (as for(; true; )) but that still requires a break statement for the terminating condition.
Slices
We don't support slices, e.g. v[3:5] to get part of a vector. This is also cumbersome to add, since the vectors used internally never change their size.
Tuple vs List
There is no distinction between tuples and lists in our AST. The main difference in Python is that Tuples are immutable while Lists are mutable. Currently, we use ExpressionLists for Python lists and don't translate Tuples. One of the disadvantages is that we cannot support return statements with multiple values (because they are tuples in Python).
The text was updated successfully, but these errors were encountered:
ABC AST Limitations
This document gathers limitations of our current AST which mainly became apparent while building the Python frontend. Some duplicates with #36 may exist.
Multi-Return Values / Multi-Assignment
What?
The following (Python) syntax is not supported in our AST:
Something similar is supported though: return values can be
ExpressionList
s, which contain (a fixed number of) entries of the same type. However, there is no multi-assignment. In fact, those vectors are never changed in size and we always operate on the full vector. All variables are vectors. Thus, assigning variables to parts of the vector is not (straightforward) to support.Why is this useful?
To efficiently translate higher level languages as Python to our framework.
Type Casting
We do not support type casting yet. I.e.,
double * int
will result in an error and not implicitly cast theint
to a double. A real intermediate representation should solve such issues.No Break Statement / No While Loop
There is no
break
statement for for-loops. This is an issue for the Python frontend, since Python has limited for-loops. Instead, we often use while-loops to express things.But without
break
, some while loops cannot easily be translated, e.g.because here, we do an update before checking the condition. This is not the same as
E.g., when we initialize
i
to100
, the first results ini = 200
, the second ini = 100
. Detecting how to transform those loops doesn't seem trivial.Of course, this is only translatable to FHE if
i
is a non-secret value. We could emulate while loops with for loops (asfor(; true; )
) but that still requires abreak
statement for the terminating condition.Slices
We don't support slices, e.g.
v[3:5]
to get part of a vector. This is also cumbersome to add, since the vectors used internally never change their size.Tuple vs List
There is no distinction between tuples and lists in our AST. The main difference in Python is that
Tuples
are immutable while Lists are mutable. Currently, we useExpressionList
s for Python lists and don't translateTuples
. One of the disadvantages is that we cannot support return statements with multiple values (because they are tuples in Python).The text was updated successfully, but these errors were encountered: