basicv2 icon indicating copy to clipboard operation
basicv2 copied to clipboard

Support keyword abbreviations

Open EricCarrGH opened this issue 1 year ago • 4 comments

Hello, great project! I'm interested in using this for future 10 Liner basic contests.

Would it be possible to have the CL compiler support abbreviations like the interpreter did as mentioned here: https://www.c64-wiki.com/wiki/BASIC_keyword_abbreviation

e.g.

12 poke 2042,13: poke 2043,13: poke 2044,13

can be shortened to effectively:

12pO2042,13:pO2043,13:pO2044,13

I could also add the code to add this functionality as a command line option, and submit a PR, if that is acceptable.

EricCarrGH avatar Jun 01 '24 04:06 EricCarrGH

I'm not sure if I see the point...if you are compiling a PRG, the abbreviations have been converted to "long" commands anyway?

Do you want the ASCII-representation of the code support these abbreviations?

EgonOlsen71 avatar Jun 10 '24 08:06 EgonOlsen71

On the original machine it's about entering more into a BASIC line than the 80 (or 88) character limitation of the screen editor would allow with unabbreviated commands.

The only reason I see here is to know that limit and not accidentally enter more commands on the PC that would be possible with the original screen editor.

Marrin avatar Jun 10 '24 19:06 Marrin

The point is, admittedly, very narrowly useful as a convenience for coding competitions that allow abbreviations.

One could provide a minified ASCII representation of source to compile and know that it compiles "as-is" rather than type it onscreen, hope no mistypes are made, and capture that as "proof of X chars per line".

I understand this does not add any real world benefits (outside of Marrin's reason) to the cross compiler, so it's fine to close if nobody else sees the need.

EricCarrGH avatar Jun 10 '24 20:06 EricCarrGH

The parser itself isn't prepared for alternative spellings of the same command. I could extend it to handle this, but looking at it briefly, I don't think that I want to...:-) It might be possible to add support for it as some kind of preprocessor instead. I'll look into it when I find the time.

EgonOlsen71 avatar Jun 18 '24 06:06 EgonOlsen71