Re: Changing + and - to succ and pred

0 views
Skip to first unread message

gk

unread,
Sep 9, 2010, 9:18:04 AM9/9/10
to cav-g...@googlegroups.com, cavlu2010_group1, cav-g...@googlegroups.com
Dear everyone,

i'm writing this to all three groups, since it concers all of us and i'd
like to have clear lines of communication instead of "stille Post".

On Thu, Sep 09, 2010 at 02:50:29PM +0200, Thomas Reinbacher wrote:
> But, we need some preprocesing for group2 to support + and -, and direct
> assignment:
>
> - Unrolling of the + and - to succ and pred, as the code of group2 cannot
> handle plus and minus
> - rewrite of the direct assignment (assign constant to variable)

I am officially confused now. I wrote an eMail to group 3 yesterday, and
Antal explicitly requested NOT to do this, since they can already handle
it and it would also add complexity to the state graph.

I implemented a simple solution (see below), but after the eMail from group 3
did not commit it into SVN. And now i'm in Styria and the code is in Vienna. :-(

So, please tell me if i should reimplement that or not. I'd like that to
be a final decission.

> - We put this in the parser, that every-time we parse a + we we first
> translate it to to pred and succ and then create the corresponding nodes.
> - Or do we first generate the ProgramNode and then traverse it and create
> a new ProgramNode that is free of + and -?

The simplest solution is Option 1: Rewrite it directly in the parser. Since we
don't yet know which variables are unused when this re-write is done, we
assign placeholdervariables. After the parse is complete and we have a
complete symbollist, we traverse the parsetree and replace all
occurences of placeholders with concrete variablenames.

Option 2 might be the more appealing design, but the necessary
vectorsplicing with STL-vectors is annoying as hell to code and actually
quite slow runtimewise, too. (STL vectors were nice when the STL was
made. Nowadays we know why they suck and use other stuff ... :-))
--
| Wolfgang Miedl | "I'm sure they'll listen to Reason"-Hiro
| <g...@xover.htu.tuwien.ac.at> | I prefer signed plaintext emails
| GPG/PGP-Key | http://xover.htu.tuwien.ac.at/~gk/gpgkey
*-----------------------------------------------------------------------

signature.asc
Reply all
Reply to author
Forward
0 new messages