endlos99 / xdt99

xdt99: TMS 99xx Cross-Development Tools
http://endlos99.github.io/xdt99
GNU General Public License v3.0
52 stars 8 forks source link

xbas99 line label names and scope #43

Closed mcvde closed 1 year ago

mcvde commented 1 year ago

This is a feature request.

  1. It'd be great to support underscores in the line label names to increase readability.
  2. An advanced feature would be limiting the scope (visibility) of line labels located in subprograms, so that duplicates within the whole program can exist, similar to using the same variable names in a program in separate subprograms. This would be helpful as there are many cases where a label such as "READ_NEXT_LINE" can be very descriptive in methods that are reading files. It's easy to have many in a program with lots of I/O. As it is right now, one must generate unique labels even when the names would otherwise be the same, such as READNEXTLINE01, ...02, etc.
endlos99 commented 1 year ago

1) should be really easy to implement; I think I just missed '_' when looking at legal chars in variable names.

2) is a good idea. I already have something like this for assembly and GPL, so again I can do something similar for BASIC. You'll have to mark these local variables somehow, since subprograms can also access global variables, and xbas99 needs to know which one is which.

mcvde commented 1 year ago

Cool, I'm glad #1 is just a simple miss. On #2, without knowing the code, even something simple such as first character must be '_' to be local would be fine to me.

endlos99 commented 1 year ago

First char must be %, which is otherwise not legal in a label name.

mcvde commented 1 year ago

Excellent. Is there a length limit to the label names?

endlos99 commented 1 year ago

No, there isn't.

endlos99 commented 1 year ago

I've just pushed a new version of xbas99.py to the xdt99 repository. Please see this file for a description of the new features.

If everything is OK, I'll make a new release on the weekend.

mcvde commented 1 year ago

Awesome. I look forward to trying out the new features. Hopefully can do so over the weekend.