Loops
Posted: Thu Sep 08, 2005 11:00 am
I would be inerested to know if loops violate the concept of context free language. In some ways, because you need to impose a limit so that the loop isn't infinite, i guess that it isn't completely context free, the execution depends on the loop condition.
But approaching the situation from another viewpoint, loops are basically a shorthand for writing a repetitive set if individual processes.
I wanted to make a rectangle, so i did this
startshape RECTANGLE
rule RECTANGLE {
SQUARE{ }
SQUARE { x 1 }
}
If I wanted to make a long rectangle, I would just have to keep typing
SQUARE { x 1 }
SQUARE { x 1 }
SQUARE { x 1 }
ect until I had the desired lenght. A simple loop control structure would simplify the process greatly. Approaching a loop from this context makes it seem like a logical inclusion. It would certainly aid in the construction of primitive shapes, and results could quickly be generated that would be incredibly tedious to hand code.
I understand the importance of remaining context free, but it seems to me that context is a relative concept. The location of each new shape is dependant on that of the previous one. I could be wrong, but it seems to me like the previous shape could be considered a context for every shape (the first shape is the only one truly without a context). Where is the line drawn?
Using loops to automate mundane entry may increase creativity, not stifle it. The reason computers are so powerful to us is their ability to do many repetitive operations quickly, so it seems that adding loop structures could possibly increase the power of the program. Interested to hear your responses.
But approaching the situation from another viewpoint, loops are basically a shorthand for writing a repetitive set if individual processes.
I wanted to make a rectangle, so i did this
startshape RECTANGLE
rule RECTANGLE {
SQUARE{ }
SQUARE { x 1 }
}
If I wanted to make a long rectangle, I would just have to keep typing
SQUARE { x 1 }
SQUARE { x 1 }
SQUARE { x 1 }
ect until I had the desired lenght. A simple loop control structure would simplify the process greatly. Approaching a loop from this context makes it seem like a logical inclusion. It would certainly aid in the construction of primitive shapes, and results could quickly be generated that would be incredibly tedious to hand code.
I understand the importance of remaining context free, but it seems to me that context is a relative concept. The location of each new shape is dependant on that of the previous one. I could be wrong, but it seems to me like the previous shape could be considered a context for every shape (the first shape is the only one truly without a context). Where is the line drawn?
Using loops to automate mundane entry may increase creativity, not stifle it. The reason computers are so powerful to us is their ability to do many repetitive operations quickly, so it seems that adding loop structures could possibly increase the power of the program. Interested to hear your responses.