On 29/09/2013, at 3:38 PM, john skaller wrote:
>
>
> var x = true, false, true;
> x . 1 = true;
>
> Note this code does not work at the moment (it will, I just haven't handled
> assignments with the new encoding scheme yet).
This code works:
var bits = false, false, false, false, false;
var q2 = bits :>> (2 * 2^3 * 2);
var q3 = false, true, false;
q2 . 1 = q3;
println$ q2;
but this does not:
q2 . 1 = false, true, false;
The reason is, the latter case is recognised as a parallel assignment.
It is coded (highly inefficiently) as:
q2. 1 . 0 = false;
q2. 1 . 1 = true;
q2.1 . 2 = false;
However my assignment to compact linear code is bugged: it only
handles a single projection, so this:
q2.1.0 = false;
looks like this:
(q2.1).0 = false
and the code assumes the argument of the projection is an lvalue.
Assign to array component 2, array = (prj1:bool * bool^3 * bool -> bool^3
q2<45382>)
Assign to array component 1, array = (prj1:bool * bool^3 * bool -> bool^3
q2<45382>)
Assign to array component 0, array = (prj1:bool * bool^3 * bool -> bool^3
q2<45382>)
/Users/johnskaller/.felix/cache/text/Users/johnskaller/felix/bits.cpp:712:18:
fatal error: expression is not
assignable
PTF q2/2%8 = (PTF q2/2%8/2u*2u+0)*1u+PTF q2/2%8%1u; //assign to packed
tuple
~~~~~~~~~~ ^
1 error generated.
Of course
q2/2%8
is the correct value of the middle 3 bits, it's just not an lvalue.
The assignment code obviously needs to recursively descend into the LHS,
to find either:
(a) A variable name
(b) A dereference operator
To make the code work we have to unravel the projections, that is evaluate
q3 . (1 . 0)
i.e. compose the projections.
--
john skaller
[email protected]
http://felix-lang.org
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language