I am working on a program that in essence makes it easier to program TI-Basic on the computer. You write a program and then run it through a "compiler" on the calculator, which makes changes to an output file. The output file is then the ultimately run file. The compiler has 5 different options (at the moment) that can be turned on or off. They are:

* Comments - Anything after // is removed.
* Whitespace - Anywhite space outside of quotes is removed. This allows one to indent as often as one chooses on the computer without worrying about removing the indents.
* For-each - I am not exactly sure how I will implement this but I plan to add for-each loop capability for lists, matrices, strings and possibly even programs.
* Optimizer - A basic optimizer, not incredibly smart, but takes care of some basic stuff.
* Preprocessor - A C-style text preprocessor. I have only two commands implemented for this -DEF and -INC. DEF does basic text replacing. For example if one did -DEF != ≠. This would allow the person to use != wherever they wanted in the program. INC allows inclusion of another program inside their own. All it does is copy the code into the program, allowing for inclusion of any code or DEF statements inside that code.

I also intend to add plug-in support for additional compiler options. BTW, I am aware that "compiler" is the wrong term, but its the only one I could think of in this context. So I'm hoping that you guys might have some ideas for additional compiler options that you would like.
I'm thinking that parser is the better term, looks like a good idea though, I'd love to see it
I believe that you used the better term in one of your features, preprocessor. I think this looks cool, I will have to look at it when it is published.
Preprocessor is indeed the correct term. As someone who has written a compiler from scratch (you know, one that turns C code into an x86 binary executable by way of x86 assembly in Linux), it pains me to hear a set of replacements and somewhat intelligent macros being called a compiler. With that said, this sounds like a very fun project, and I look forward to seeing how it progresses. How does SourceCoder fit into this? Smile
KermMartian wrote:
Preprocessor is indeed the correct term. As someone who has written a compiler from scratch (you know, one that turns C code into an x86 binary executable by way of x86 assembly in Linux), it pains me to hear a set of replacements and somewhat intelligent macros being called a compiler. With that said, this sounds like a very fun project, and I look forward to seeing how it progresses. How does SourceCoder fit into this? Smile


You wrote a compiler??? why??? Is it available on the net?

Zaphod Beeblebrox I forgot to ask, is this a program on calc or on comp?
Glenn wrote:
KermMartian wrote:
Preprocessor is indeed the correct term. As someone who has written a compiler from scratch (you know, one that turns C code into an x86 binary executable by way of x86 assembly in Linux), it pains me to hear a set of replacements and somewhat intelligent macros being called a compiler. With that said, this sounds like a very fun project, and I look forward to seeing how it progresses. How does SourceCoder fit into this? Smile


You wrote a compiler??? why??? Is it available on the net?


Compiler Construction is a common class for EE/CS students.
Oh, I never would have realized that.
The program is a on the calculator (although I suppose I could write one for the computer). However, it is meant to make writing programs on the computer easier. So I have the preprocessor, comments and whitespace have been taken care of. I'm not really up to date on what SourceCoder does, but I think in terms of optimizations it should provided some basic stuff that SourceCoder probably provides. I will post a code sample of input and output code as soon as I get a chance.
Glenn wrote:
You wrote a compiler??? why??? Is it available on the net?


I've wrote a compiler as well. It isn't that hard to make a simple compiler *shrug*

The real question is why you would want it. Kerm's compiler sucks donkey balls compared to GCC, VC++, and the like.
Kllrnohj wrote:
I've written a compiler as well.

Or "I wrote," but don't combine the two.

Zaphod: This is a very useful sounding project. You should create a computer version that tokenizes+generates an .8xp as well.
elfprince13 wrote:
Kllrnohj wrote:
I've written a compiler as well.

Or "I wrote," but don't combine the two.


?
Seems like it could be an interesting project to watch grow Smile
Kllrnohj wrote:
Glenn wrote:
You wrote a compiler??? why??? Is it available on the net?


I've wrote a compiler as well. It isn't that hard to make a simple compiler *shrug*

The real question is why you would want it. Kerm's compiler sucks donkey balls compared to GCC, VC++, and the like.


I was curious about it, I wouldn't necessarily use it but I was curious to see what it was like.
Ultimate Dev'r wrote:
elfprince13 wrote:
Kllrnohj wrote:
I've written a compiler as well.

Or "I wrote," but don't combine the two.


?


He said "I've wrote," which is fairly failtastic, coming from our most anal grammar nazi. I was pointing out to him that "I have written" or "I wrote" would both be correct, but "I have wrote" would not. Mixing tenses == fail.
elfprince13 wrote:
Ultimate Dev'r wrote:
elfprince13 wrote:
Kllrnohj wrote:
I've written a compiler as well.

Or "I wrote," but don't combine the two.


?


He said "I've wrote," which is fairly failtastic, coming from our most anal grammar nazi. I was pointing out to him that "I have written" or "I wrote" would both be correct, but "I have wrote" would not. Mixing tenses == fail.


BTW where is the Grammar Nazi? Can he come out and play? Smile
elfprince13 wrote:
He said "I've wrote," which is fairly failtastic, coming from our most anal grammar nazi. I was pointing out to him that "I have written" or "I wrote" would both be correct, but "I have wrote" would not. Mixing tenses == fail.


The only thing failtastic in this thread is your memory...
Kllrnohj, I bet mine was more complex than yours. Smile I supported the full C99 standard, except for some strangeness with typedefs that would have made my parser three times as complex as it was, and would also technically break my hierarchical, modular model. It even did some rudimentary optimization to minimize the use of temp registers. Smile
KermMartian wrote:
Kllrnohj, I bet mine was more complex than yours. Smile I supported the full C99 standard, except for some strangeness with typedefs that would have made my parser three times as complex as it was, and would also technically break my hierarchical, modular model. It even did some rudimentary optimization to minimize the use of temp registers. Smile


I was a real man and made my owner grammar spec rather than steal one Razz (it was also a high level language inspired by Python)

But yes, yours does sound more complex (well, more complete, anyway) - then again, I did mine just while I was in class (and I never took any classes on compilers Wink ). Was yours a single pass or did you do it properly (tokenize, grammar check, AST, etc...)? Did you use any tools (lex/yacc, etc..)?
Kllrnohj wrote:

The only thing failtastic in this thread is your memory...


I like how you didn't even bother checking your own post to see if I was right or not.

elfprince13 wrote:
Kllrnohj wrote:

The only thing failtastic in this thread is your memory...


I like how you didn't even bother checking your own post to see if I was right or not.



Nice circle Good Idea
  
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 2
» 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