Translating AsWing

Posted on October 14, 2008. Filed under: Uncategorized | Tags: , , |

Since the last blog post, as3tohaxe converter now has expression parsing, “as” converted to “cast ()” calls, and a program, as3tohaxe.hs, to run through a directory recursively and convert!

So I gave the converter the AsWing codebase as its first big test and ran into a couple problems.

The parser was bombing on some unidentifiable characters which turned out to be the UTF8 header sequence “\239\187\191” or EF BB BF in hex. At first I just tried removing those characters but couldn’t with vim because the character is “zero width”. So I used a hex editor, 0xED, and the parser ran without issue. So I’ve updated the lexer to handle the header as whitespace.

The second problem I came across was one file taking a particularly long time converting. I think it has to do with one of the statements which has a nested expression.

((((((((("GridLayout[hgap=") + hgap) + ",vgap=") + vgap) + ",rows=") + rows) + ",cols=") + cols) + "]");

I still need to verify this.

Update: The nested expressions were causing the slowdown. I removed redundant work being done by the parser and got a huge speedup.

Advertisements

Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: