Chunk Expressions

This week I started wrapping up work on one of the last major Lingo features which was still unimplemented – chunk expressions.

Chunk expressions refer to chunks of text, such as char 3 of "test", word 1 to 10 of variable, or item 3 of "foo,bar,baz". These can be used to used to manipulate text in various ways, like highlighting chunks of text like in the screenshot above, deleting chunks of text, or inserting text before/into/after chunks of text.

After refactoring how references to text chunks work and implementing the hilite and delete commands, I ran into my old foe the Lingo parser again. Right now, the Lingo parser can’t differentiate between when we need something’s value (e.g. put char 1 of variable) and when we need a reference to something (e.g. hilite char 1 of variable). The current hack is to always push a reference and evaluate that reference later if needed. The parser’s gotten rather brittle, so it’s been difficult to change it to remove this hack… or to make any changes, really.

To solve this, I’ve started a major refactoring of the Lingo compiler which should make it a lot more flexible. This will allow references to be properly handled, and it should also allow us to eliminate most of the grammar’s plentiful hacks. I’ll be working on this most of this week, so more on this later!


Leave a Reply

Your email address will not be published. Required fields are marked *