Version 3 syntax translation

New releases, news, and anything else important.

Moderators: MtnViewJohn, chris, mtnviewmark

Locked
User avatar
MtnViewJohn
Site Admin
Posts: 875
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Version 3 syntax translation

Post by MtnViewJohn »

I have added a version 2 to version 3 syntax translation capability to the gallery. Check it out at http://www.contextfreeart.org/gallery/translate.php. Individual designs also have Translate buttons that also take you to that page. Please try it out and post here if you have any cfdg files that fail to translate.

User avatar
Monkstone
Posts: 13
Joined: Fri Jul 03, 2009 10:40 pm
Location: Pembrokeshire, UK
Contact:

Re: Version 3 syntax translation

Post by Monkstone »

Excellent, I expect will mainly work. Interesting fails with [link design:2335] crosstile [/link] see my manual translation [link design:2722] here [/link], however that is on that had me stumped for a while.

User avatar
MtnViewJohn
Site Admin
Posts: 875
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Version 3 syntax translation

Post by MtnViewJohn »

I think that the wavy path in crosstile looks the way it does because of a bug in bezier rotation in version 2.

User avatar
kipling
Posts: 91
Joined: Wed Jun 18, 2008 2:36 am

Re: Version 3 syntax translation

Post by kipling »

HI John

I have only just seriously started looking at CF3 ... I've been busy.

It is nice to see a lot of new features come to life. It is also nice to see that you have managed a fair shift in how the language works while still keeping a lot of the character.

I tried the translate option on a cfdg with target colours, and it doesn't work - it does a fairly literal translation, which when given to ContextFree gives "Parse error - Color target feature unavailable in shapes".

I understand that the intended replacement uses the new target syntax. However, this assumes that the rule "knows" the target colour, and the only examples given in the new docs have a constant colour as the target. So I am guessing that the way to have an inherited target colour is to explicitly pass this information down the object hierarchy via shape parameters. I haven't actually tried this myself, nor figured out whether every quirk of the old behaviour can be simulated in CF3.

Once I have figured it out I'll update the tutorial on colour targets.

If my guess about the "correct" way to get the old target behaviour is correct, my second guess is that there is not much to be gained from having a tool that automatically translates these. Maybe it should throw a warning, though.

User avatar
MtnViewJohn
Site Admin
Posts: 875
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Version 3 syntax translation

Post by MtnViewJohn »

I will update the translation tool to inform the user if it has punted on translating color targets.

The translator tool is very dumb. Comments and white space are copied over directly. All lexical elements are directly translated to the new syntax. There is a little bit of intelligence to detect shapes with just one rule so that the superfluous rule tokens can be stripped out. To properly translate color targets would require converting the cfdg file to an abstract syntax tree and doing some analysis to push the color target changes down to where they are required. Mark was planning to write this in Haskell. But I created the dumb translator in PHP to facilitate the release of version 3 beta and Mark moved on to other projects.

User avatar
kipling
Posts: 91
Joined: Wed Jun 18, 2008 2:36 am

Re: Version 3 syntax translation

Post by kipling »

OK thanks. I figured that the translator operated mostly at the syntactic level.
On colour targets, I understand why it makes sense to minimise the number of variables passed through the object hierarchy, particularly those that a bit obscure.
I have had some fun with the new symmetry options, in particular the "roll your own symmetry group" feature. I'll be putting something on the gallery (and maybe the wiki) once I get it polished.

Locked