4 ms·
And for some, its just as easy and straightforward to write code that's meta-code as it is to write a static embodiment. Is it overbuilt? Overcomplicated? Depen
by JoeAltmaier 7y ago
And for some, its just as easy and straightforward to write code that's meta-code as it is to write a static embodiment. Is it overbuilt? Overcomplicated? Depends entirely on the reader.
I wrote an OS initialization file parser long ago. Wanted to be able to add new items simply. So, could either use a pattern to recursive-descent parse the file (that could be extended by cut-paste-edit), or could write a table-driven parser. Neither was more or less complicated, really.
So I wrote the table-driven one. And the table was a text syntax, which I parsed in the recursive-descent style. But its syntax was far simpler than the text it would parse, containing only 'exact match', 'zero or more of', 'one or more of' elements. From that, you could create pretty much any kind of initialization file we needed by providing a text pattern.
Did I over-complicate it? The syntax was extended half a dozen times only. But did that matter? It took me about the same time to write it this way (half a day).