Recently I've been working on a program aimed at helping basic programmers enter long lines of code without having to enter it all by hand.
how it works is you enter your code like normal, but instead of entering a long line of code you enter a ^ then the command, when you run Grey.Fox+ it will ask you what program you want to compile then it will search through it for a ^ when it gets too one it will scroll through the Library and fond the replacement, when it has found the replacement it will copy the code into a temporary file along with the code that hasn't got a ^, after it gets to a .. symbolizing the end of the area needing compiling it will prompt you to tell it which file you want to compile it too, and it will create the file and copy over the temp, then it will delete the temp. the library is easy to edit and add your own code to.
I'm going to post its beta soon and it would be nice if some constructive criticism came in, as well as help with any problems I have with it

EDIT:
I have finally finished the project. if anybody has some ideas for a ++ version just post it

Now at the third revision. Work on the second version is now under way
http://www.cemetech.net/programs/index.php?mode=file&path=/83plus/basic/programs/Grey.fox_plus_v1.3.7.zip

VERSION HISTORY:
v0.1b did not work at all
v0.2b fixed bug first working version
v0.3b first upload, small code optimizations
v0.4b added more to the lib, more code optimization
v0.5b better read me, commenting added
v0.6b final beta, more code optimizations, got rid of theta TEMP program
v1.0 first none beta, never uploaded. delete source code option added
v1.0.1 small fix to code. final version.
v1.2.0 and its small counterparts were had larger code fixes, mainly getting rid of the extra files. Also the error trap was moved into the GDFP program
v1.3.0 included more functions
v1.3.2 and up stabilized the code and included the unreleased GDFPF program (allows you to add commands to the library safely without deleting other commands
v1.3.7 was the first completely stable code of this revision


::SOURCE CODE OF THE PARSER::

Code:
::"Grey.Fox+ Parser v1.3.7
::DCS6
:"89B3FA2AAAAB71B2700020200070C023E0073FFC3FFFE000C4240A66AA254576
:Lbl 1
:ClrHome
:Menu("Grey.Fox+ Parser","Parse",P,"Add to Lib",A,"Quit",Q
:Lbl P
:Disp "Grey.Fox+ Parser
:Input "prgm",Str1
:Input "Parsed-prgm",Str2
:"θLIB→Str3
:Str2→Str0
:12→θ
:Asm(prgmθC3
:0→K
:0→A
:" →Str9
:While Str9≠"..
:ClrHome
:A+1→A
:1→θ
:Str1→Str0
:A:Asm(prgmθC3
:If sub(Str9,1,1)="+
:sub(Str9,2,length(Str9)-1→Str3
:If sub(Str9,1,1)="*
:Then
:ClrHome
:Disp "INSERTING
:Output(1,11,sub(Str9,2,length(Str9)-1
:A-1→A
:sub(Str9,2,length(Str9)-1)→Str4
:0→M
:Str1→Str0
:3→θ
:A+1:Asm(prgmθC3
:While Str9≠"..
:M+1→M
:Str4→Str0
:1→θ
:M:Asm(prgmθC3
:If Str9≠"..
:Then
:Str1→Str0
:Str9→Str7
:Output(2,1,"               
:Output(2,1,Str9
:2→θ
:Str7→Str9
:A+1:Asm(prgmθC3
:End
:End
:"*→Str9
:End
:If sub(Str9,1,1)="^
:Then
:Str9→Str8
:Output(1,1,Str9
:Str3→Str0
:{-}1→L
:" →Str9
:While Str9≠Str8
:1→θ
:L+2→L
:L:Asm(prgmθC3
:Output(2,1,"               
:Output(2,1,Str9
:If Str9="..
:Then
:ClrHome
:Disp "Err::syntax
:Output(3,1,"----------------
:Output(4,1,Str8
:Input "::Correction::",Str8
:{-}1→L
:End
:End
:L+1→L
:L:Asm(prgmθC3
:Str2→Str0
:K+1→K
:2→θ
:K:Asm(prgmθC3
:Output(3,1,Str9
:Else
:sub(Str9,1,1)→Str7
:If Str9≠".." and Str7≠">" and Str7≠"+" and Str7≠"*
:Then
:K+1→K
:2→θ
:Str2→Str0
:K:Asm(prgmθC3
:Output(3,1,Str9
:End
:End
:End
:ClrHome
:Pause "Program parsed
:Menu("Delete source?","Yes",D,"No",Q
:Lbl D
:7→θ
:Str1→Str0
:Asm(prgmθC3
:Lbl Q
:ClrHome
:Output(1,14,"   
:Return
:Lbl A
:Output(1,1,"GDF+ FORMATTER     v0.1b"
:Pause
:Lbl 0
:ClrHome
:Input "Cmd name: ^",Str8
:"^"+Str8→Str8
:Input "Cmd insert: ",Str9
:2→θ
:"θLIB→Str0
:1:Asm(prgmθC3
:Str8→Str9
:1:Asm(prgmθC3
:Menu("MORE?","Yes",0,"No",1
Generated by SourceCoder (http://www.cemetech.net/projects/basicelite/sourcecoder.php)
© 2005 Cemetech (http://www.cemetech.net)


::SOURCE FOR THE LIB::

Code:
:^OUT
:Output(1,1,Ans
:^GRSET
:Func:CoordOn:GridOff:AxesOn:LabelOff:ExprOn
:^TEXT
:0→X:0→Y:0→K:While K≠105:Pxl-Change(Y,X):0→K:While K=0:getKey→K:End:Pxl-Change(Y,X):If K=24:X-1→X:If K=25:Y-1→Y:If K=26:X+1→X:If K=34:Y+1→Y:If X={-}1:0→X:If X=95:94→X:If Y={-}1:0→Y:If Y=65:64→Y:End:Input "Text(Y,X,'",Str1:Text(Y,X,Str1
:^SHADE
:Disp "":Output(1,1,"Shade(":Input "",Str1:Str►Equ(Str1,X<span style="font-size: 0.7em">1T</span>):ClrHome:Disp "":Output(1,1,"Shade(0,":Input "",Str1:Str►Equ(Str1,Y<span style="font-size: 0.7em">1T</span>):Shade(X<span style="font-size: 0.7em">1T</span>,Y<span style="font-size: 0.7em">1T</span>
:^GSET
:ClrDraw:Func:CoordOff:GridOff:AxesOff:LabelOff:ExprOff:ZStandard
:^PAUSE
:0→K:0→E:Repeat K or E<20:getKey→K:E+1→E:End
:^CIRCLE
:Input :X→A:Y→B:Input :sqrt((X-A){^2}+(Y-B){^2})→C:Circle(A,B,C
:^QUITS
:ClrHome:ClrDraw:AxesOn:Stop
:^QUITR
:ClrHome:ClrDraw:Return
:^SETPROG
:Input "NEWFILE: ",Str0:det(0,Str0,5)
:^DELPROG
:Input "DELFILE: ",Str0:det(0,Str0,4
:^STATS
:det(4,0):Ans→R:det(4,1):Ans→A:det(4,3):Ans→Str1
:^GGF
:Input "GROUP?",Str0:det(11,Str0):Output(1,1,Ans):Pause :Input "EXTRACT?",A:det(12,Str0,A):If Ans:Disp "DONE":If not(Ans):Disp "Err::?"
:^CLR
:real(0,1):ClrHome
:^SCREEN
:AxesOff:real(7,0):real(6
:^A PROG
:Input "RUN prgm",Str0:Str0:real(10,0,0
:^XK
:real(8
:^MOS HDR
::"Grey.Fox+ parsed
:^A-GET
:Repeat getKey:End
:^K-GET
:0→K:While not(K):getKey→K:End
:^D8 HDR
::DCS
:^D16 HDR
::DCS6
:^ICON8
:"3F5191FB8F8581FF
:^ICON16
:"3E5B529692BBF24296109E388A10FE00000065B45AAA69A24080028001000000
:^GREY1
:0→K:While not(K):real(3,1,0,1):real(3,2,0,1):getKey→K:End
:^GREY2
:0→K:While not(K):real(3,3,0,1):real(3,4,0,1):getKey→K:End
:^NO DONE
:ClrHome:Output(1,14,"   
:^NO DONE ASM
:Asm(prgmθKD
:^PEN
:0→X:0→Y:0→K:While K≠105:Pxl-Change(Y,X):0→K:While K=0:getKey→K:End:Pxl-Change(Y,X):If K=21:Pxl-Change(Y,X):If K=24:X-1→X:If K=25:Y-1→Y:If K=26:X+1→X:If K=34:Y+1→Y:If X={-}1:0→X:If X=95:94→X:If Y={-}1:0→Y:If Y=65:64→Y:End
:^LINE
:Input :X→A:Y→B:Pt-On(X,Y):Input :Line(X,Y,A,B
:^X-TEST
:1:real(0):If not(Ans):Then:ClrHome:Disp "INSTALL xLIB":Return:End
:^DISP
:Disp Ans
:..
:..
Generated by SourceCoder (http://www.cemetech.net/projects/basicelite/sourcecoder.php)
© 2005 Cemetech (http://www.cemetech.net)
Ah, did I see a beta of this on ticalc.org? I watched the screenshot, but I wasn't exactly sure what the point of it was. So tell me if I understand correctly, ^ is a shortcut to insert the contents of another program to replace the ^?
oh the one on ticalc is a old version, that's more of a language in itself. the + version is completely different, i use Celtic 3 to do the work right now
no in the program if you enter a ^ at the start of the line it will search for the command that is placed after it and replace the line with the line in the library that corresponds with the command, although I'm having problems with it now, it was working last night but it wont compile the commands any more... if i knew how to add a screenshot i would, but i don't know how too. here is the library if you need a bit more clarification

EDIT: i moved the code to the first post
Oh, I think I get it now, it's like a set of macros to insert frequently-used sequences of commands. That's pretty useful, actually, nice.
yeah it was working pretty well, but when i tried to make a screenshot of it in action it failed, i looked at the code and it should work, but it doesn't. ill upload it so you can take a look at it if you want
Eeems wrote:
yeah it was working pretty well, but when i tried to make a screenshot of it in action it failed, i looked at the code and it should work, but it doesn't. ill upload it so you can take a look at it if you want
OK. You could also post the code from SourceCoder if you want, that might be more helpful.
and you already have the library
so yeah, the prgmθC3 is Celtic 3, i just renamed it to put it lower on the list, and to save bytes

EDIT: I have moved all the codes to the first post
i found some of the problems, looks like i forgot to reset str9 before the Lib. also i fixed the error trap to make it work. i had it editing the wrong string
Right off the bat, I see a bunch of memory leak problems, where you're Goto'ing out of End-terminated constructions. That's not good.
I've been trying to limit that, one i have on purpose in the compiler, it makes it skip the lib checking part, but I'll look through it and try to restructure it. if you could give me some ideas for expansion on the lib it would be great, cause it isn't that big yet
Huh, interesting idea!
If I were using it, though, I'd probably switch the "^" for something that gets used a little less frequently, like an accent mark or something. I can see in your source where to change it though, so it's not terribly inconvenient to change it to whatever I want.
jbr wrote:
Huh, interesting idea!
If I were using it, though, I'd probably switch the "^" for something that gets used a little less frequently, like an accent mark or something. I can see in your source where to change it though, so it's not terribly inconvenient to change it to whatever I want.
How about something that nobody ever uses for anything, like ANOVA( or tvm_N( or Fcdf( or something?
KermMartian wrote:
jbr wrote:
Huh, interesting idea!
If I were using it, though, I'd probably switch the "^" for something that gets used a little less frequently, like an accent mark or something. I can see in your source where to change it though, so it's not terribly inconvenient to change it to whatever I want.
How about something that nobody ever uses for anything, like ANOVA( or tvm_N( or Fcdf( or something?

Or like the case of ANOVA( that few people even know what it does let alone use.
well no one really uses ^ at the start of the line, but i could change it...by the way what does the ANOVA( command do anyway?

I'm going to update the code again with a way to get around the lbl A and ER using if statements
You should talk to Zaphod (Jonah S) about getting this implemented within Lunar IDE
yeah that sounds like a good idea
Eeems wrote:
well no one really uses ^ at the start of the line, but i could change it...by the way what does the ANOVA( command do anyway?

I'm going to update the code again with a way to get around the lbl A and ER using if statements
Excellent, glad to hear it.

A sidebar about ANOVA (ANalysis Of VAriance) for those unfamiliar with the concepts: http://en.wikipedia.org/wiki/Analysis_of_variance
thanks for the article, i think I'll just get rid of the ER lbl because it doesn't work completely right
EDIT: i hadn't even included it in this version of the code so i don't need to get rid of it.
EDIT: if anyone has any other suggestions for the Lib, that would be nice. i have a more recent version that I am going to post for you guys to critique
hmm,

Code:
o:Repeat(Ans:GetKey:End

and

Code:
DelVar E: Repeat(Ans or E>20:E++: GetKey:End:


are two that I use ALL the time... hey wait, does anyone remember if var++ works in tibasic?
I'll add them, what do you want the short hand code to be?

and sorry i don't know what var++ is
  
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 3
» All times are UTC - 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