This project is probably not what you think it is. Rather it is a program I would have found useful. The idea is to take a TI-Basic Program, and compile it with it's subroutines into a single program. This would be very helpful for especially earlier TI-Basic programmers who tend to use many programs, rather than a single massive one, as well as others.

Features
Read in name of program to compile--Done.
Allow multiple layers of subroutines... maybe--Not done
Actually compile the program--not done.

Yeah so basically I haven't done much but plan out the program and play around with ICE. Anyway I'll probably ask questions and such since I'm not that good at ICE programming.
You want a program that searches for subprograms, then replaces that line with the contents of the subprogram, all that recursively. You can't do that in pure basic though.

Personally, I think that if you want to use a bunch of subprograms (like java methods or vbs functions), then basic is not the best language to be doing that in. Also, oftentimes, people place their code in a subprogram because they want to call it many times, so they want to save memory by not copy-pasting it a zillion times. Replacing every occurrence of the subprogram call by the contents of the subprogram would be defeating the purpose...
mr womp womp wrote:
Also, oftentimes, people place their code in a subprogram because they want to call it many times, so they want to save memory by not copy-pasting it a zillion times. Replacing every occurrence of the subprogram call by the contents of the subprogram would be defeating the purpose...

If there is a subprogram that is called many times, you could convert it to a label.
Good luck, but this is much harder than you would think. What if a subprogram returns before the end of the program? Then you need to replace that with a Goto to the end of the program, like this:


Code:
prgmA:
2->A
prgmB
1->B

prgmB:
If A=2
Return
A-1->A


would become


Code:
prgmA:
2->A
If A=2
Goto AB
A-1->A
1->B


And you might already notice it, that can cause memory leaks, so good luck solving that. Wink
Or, alternatively,

Code:
prgmTHIS:

If(S=1
Goto A
If(S=2
Goto B
"Do stuff and call subprogram A"
1→S
prgmTHIS
Lbl A
"Subroutine A"
0→S
Return
Lbl B
"Subroutine B"
0→S
Return

This has the disadvantage that if S is initially 1 or 2, the program will do a subroutine rather than the man program.
PT_ wrote:
Good luck, but this is much harder than you would think. What if a subprogram returns before the end of the program? Then you need to replace that with a Goto to the end of the program, like this:

If it returns in the middle of a 'If' or 'Return', it would still cause issues with a leak, wouldn't it?

mr womp womp... This is for the TI-84 Plus CE... TBH the amount of even RAM is large enough on these new ones that space really is less of an issue. And people who might use this probably already have PHASM or something... So space becomes less of an issue I think. Especially with how much more difficult it is to do LBLs.

Though, if it really becomes an issue, I could try to put something in. It would be slightly complex... I'd have to look for unused lbls and variables and such...


IDK I'm just trying really hard not to do another vaporware program like some of the past ones I've had.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement