Templates and Constants

Let the developers know what you think of the software and what can be done to either improve the CFDG language or the Context Free program.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
t3knomanser
Posts: 21
Joined: Wed Jul 06, 2005 4:53 pm

Templates and Constants

Post by t3knomanser »

This is a two-parter. The first feature, and I don't think I need to make much of an argument in favor of this one, is the ability to have templates. Pre-commented files customized with your name, copyright information, etc. Considering I use the same basic combination of rules a lot (the core element of my files is usually called "BASE", I often name my startshape "SCENE"), it would certainly make my life easier.

I have a hunch that there'll be more opposition to the second, because it bends the Context-Free part- constants. Very often, I'll use the same value in multiple places, as a scaling factor, a weighting, translation value, or what-have-you. Then, I decide I don't like it, and now, I have to change twenty locations in order to make that simple change. Constants would be a valuable shorthand, and really, they could be done not as an addition to the CFDG, but as a pre-processor directive. A literal substitution a la C pre-processor commands.

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

Post by MtnViewJohn »

How about if we had a menu called 'Library' which worked like the Examples menu but it just was built from the contents of some directory? You could put all your templates in a directory, tell Context Free where it is, and Context Free would enumerate the cfdg files under it and make a menu. We could even make it heirarchical.

Global constants are not a problem. Yevgen Korshykov has them in his online version of CFDG: http://www.korsh.com/cfdg/. I can see Context Free copying that. Also, it would be nice to have expressions. How many people look at 0.866 and see SQRT(3)/2?

t3knomanser
Posts: 21
Joined: Wed Jul 06, 2005 4:53 pm

Post by t3knomanser »

That's a fine solution for templates. And expressions would also be really cool, but it would certainly complicate the parser a great deal.

User avatar
aaronstj
Posts: 66
Joined: Wed Jul 06, 2005 11:34 am
Location: Seattle

Post by aaronstj »

Expressions actually aren't that bad under lex/yacc. They're a cool little pair of programs, worth checking out how they work. And since yacc is used to parse context free grammars, it's very relevant.

Post Reply