Supporting void with-loops
Bugzilla Link | 1120 |
Created on | Mar 25, 2014 16:41 |
Version | svn |
OS | All |
Architecture | All |
Extended Description
SaC syntax allows void with-loops. Unfortunately they are not supported by the compiler. Here are the steps that we have identified (Artem, Bodo) to fix the problem. 1) Adjusting parser. Currently the parser doesn't support void with-loops. It has been fixed in the branch called [origin/parser-fix] with a the following syntax adjustment: A void with-loop requires void statement of the generator which can be expressed as: with { (...): foo (); }: void; in which case foo must be void, with { (...) { ... }: void; }: void; or with { (...) { ... }: foo (); }: void; where foo is void. 2) Flattening requires adjustment. The problem is that when flattening sees expression like: with { (...): foo (); }: void; it flattens it to: with { (...) {tmp = foo ();}: tmp; }: void; and obviously dies, as there is no foo which returns one argument. Solution: normalize generators of the void with-loop as follows: (...): foo (); -> (...) { foo (); }: void; (...): { ... }: expr; -> (...) { ...; expr; }: void 3) Reference parameters are not being resolved properly in the void with-loops. use IntStack: all; int main () { s = create_stack (); with { ([0] <= [i]
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information