18 hours ago, TomXP411 said:
Yeah, that's largely how this one works, but since I wanted the short variable naming to be automatic, I needed to know the text of all the reserved words. That way I didn't try to shorten "FOR" or "THEN".
I've also got some additional syntax rules, compared to BASIC 2. Among other things, a space between keywords and variable names is required. So no FORT=1TO100. That would cause the parser to think FORT is a word, and it would try to shorten it to FO. I plan to include packing in a fourth pass, so the final output might indeed look like that, but the input definitely cannot. ?
Oh my goodness yes ... even in a hosted Basic transpiler, 80 columns and 30ish rows is enough that there is no reason to have crunched source.
Also, on indents, while eight column tabstops is the traditional 80s standard for programming and five column tabstops the standard for text editing, to my eye either three or four column tabstops work fine. When working on BMW, my pure text character line editor for & in Forth, I had a first line tabstop define, where if the first line was a comment line:
\ -+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
or
\ --+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
... would give three or four column tabstopping, respectively. The test for a tabstop line was "Does it start with the string Comment character, space, - character? If so, skip any additional - characters, is the next character a +? If so, this is a tabstop comment, store it in the tabstop definition buffer". The indent out and indent back routines are the only ones that have to read the tabstop definition buffer, since they set the current tab indent column and that value is what the line display routine uses. There was no need for a tabstop setting command, since, eg, loading file consisting of nothing but a tabstop comment with 8 column tabstops would "set" the tabstop to 8 columns. Loading it into the copy and paste buffer rather than the main file buffer could set it after the file was loaded.
A similar thing can be done in the editor for any language that has a single character, single character plus space, or double character comment symbol, to support arbitrary regular column tabstops from 3 columns on up.