Analyzing Control Structures
Posted: Mon Oct 26, 2020 1:09 pm
I have a domain specific language. Users write scripts in it. I have a tracer that allows them to step through the scripts line by line. The scripting language allows most of the Dyalog control structures :For, :While, :If, etc.
Being lazy, I like to get the interpreter to do most of the work for me. If a take a script in my DSL and fix it as a Dyalog function, all of the control structures are case normalized, indented, lined, up, etc. I can then do some relatively easy analysis of the ⎕NR of the function, to see, for example, where the end of a for loop is.
Obviously the interpreter is doing a fair amount of work at fix time. How much of the analysis of the control structures is used just for formatting the function, and how much, if any, is being used later when the function is being executed? In other words, when the interpreter is executing a function, does it have some sort of pre-computed data structure of the control structures that might be useful to me?
How much of this stuff could be made available to the APL programmer in an I-beam? Right now there are a couple of I-Beams that give info on syntax coloring, but I think that is the extent of it. There is probably other stuff that happens when a function is fixed that I would find useful when when writing my tracer too...
Being lazy, I like to get the interpreter to do most of the work for me. If a take a script in my DSL and fix it as a Dyalog function, all of the control structures are case normalized, indented, lined, up, etc. I can then do some relatively easy analysis of the ⎕NR of the function, to see, for example, where the end of a for loop is.
Obviously the interpreter is doing a fair amount of work at fix time. How much of the analysis of the control structures is used just for formatting the function, and how much, if any, is being used later when the function is being executed? In other words, when the interpreter is executing a function, does it have some sort of pre-computed data structure of the control structures that might be useful to me?
How much of this stuff could be made available to the APL programmer in an I-beam? Right now there are a couple of I-Beams that give info on syntax coloring, but I think that is the extent of it. There is probably other stuff that happens when a function is fixed that I would find useful when when writing my tracer too...