I'm trying to learn C. So, the way that I would learn it the easiest, is to be able to program in C directly on my calculator. That is the reason I learned TI-BASIC. So could anyone possibly make an On-Calc C Compiler? That would help a lot.
An on-calculator C compiler simply will not happen (1, it would take ages and 2, no exception handling would mean you'd lose the program and source right after you finished compiling and executing it). However, if you have a CE calculator, you can use Zilog's SDK or Mateo's C libraries to compile C code to ez80 binary. Otherwise, you have to use assembly...
The thing with C is that it has a very large infrastructure, including a preprocessor, compiler, assembler, and linker. The complier is a small thing in reality. There's simply nothing that beats C in terms of performance, ease of use, functionality, adaptability and portability that will ever exist for the calc, because it is a language that has been around for over 35 years of standards. However, the toolchain is extremely easy to set up, and there are multiple demos useful for experimenting and learning, and there are hundreds of tutorials online for anything you might need Smile
oldmud0 wrote:
An on-calculator C compiler simply will not happen (1, it would take ages and 2, no exception handling would mean you'd lose the program and source right after you finished compiling and executing it). However, if you have a CE calculator, you can use Zilog's SDK or Mateo's C libraries to compile C code to ez80 binary. Otherwise, you have to use assembly...


Well, there was an on-calc C compiler for the 68k calcs (e.g. the TI-89, TI-92+, and Voyage 200): GTC (which, sadly, seems to have a defunct website, but I have a copy somewhere and I'm sure it's available elsewhere on the internet.). I only ever used it to compile a hello world program, but it worked!

It's unlikely to happen on the TI-84+ CE, sure, but hardly impossible.
The main reason for wanting an on-calc C compiler is if someone doesn't own a computer (eg limited computer access or simply can't afford to buy one) or wants to code while they can't access one.
DJ_O wrote:
The main reason for wanting an on-calc C compiler is if someone doesn't own a computer (eg limited computer access or simply can't afford to buy one) or wants to code while they can't access one.

Seriously, I know, but I don't think anyone actually understands what a C toolchain consists of. It's not just a compiler, and there are very few people out there that could even make a C compiler, even on the computer.
What Mateo is referring to is the necessity of headers and libraries. Standard I/O, how's that going to happen? How are you going to include if files aren't real files? What's the point of .h then? Where's my pointer safety? Where's your keyboard? Where are compiler parameters going to be inputted? I made a library, how can I link it statically or dynamically with my program? What, which one do I want to use? Division, what's that? Am I to use `int` or `long`? How do I do all of this without basically requiring POSIX compliance? How do I make a C compiler in ASM? Then after that can I make a C compiler in C thus bootstrapping the compiler? That sound fair enough? Of course not, why are the standard libraries taking 10k of my RAM per program?

You see, making a C compiler solves a lot of problems at the same time but you've still got to know how to solve them.
Hi, I'm in a rush and have to admit I didn't read everything here, but wanted to suggest the following substitute: gbl08ma utilities add-in with PICOC support for casio fx-cg calculators (prizm). It does not exactly compile c code, but at least you can develop and run or debug your c code directly on calculator. Hope it helps
While googling some syscall for prizm i came accross the following oncalc c compiler for casio fx9860 series just now: http://wiki.planet-casio.com/en/WSC_and_FVM (I don't have any of this series' calculators to test unfortunately) but have a look
While in theory, an on-calc C compiler would be great, it would be fairly impractical. I could see it being done as an application, but the toolchain for a basic C89 compiler without any libraries would be at least 100kb, which admittedly is not outside the realm of possibility.

The biggest obstacles in the way of having a C compiler on the calculator are typing and debugging.

When you're doing development on the computer, you have access to all the debugging facilities of the various emulators. On the calculator, the only feedback you really get is a hard crash, or maybe garbage on the screen.

And the typing... Just try typing out a small program on the homescreen. It's a real pain in the butt, isn't it? Further, you'd also probably also need a reference manual when you're programming on the calculator as well, since you wouldn't have access to the various internet resources if you're actually programming without a computer handy.
I wonder what calculator calcnerd had in mind, some calculators even have qwerty keyboards. But writing lots of code is easier on large screen with auto-complete etc, no doubt.

However having something independent of PC and of specific PC setups (linux vs windows and so on) is also good, and in some instances debugging could be easier on calculator actually especially if there is no suitable emulator, or just to save time uploading the file to be tested from pc to calculator multiple times, but that would be only good for projects which need frequent debugging and not much writing due to the reasons you highlighted
An on-calc C compiler is entirely possible. With a total of some 406 K of RAM and more than 3 MB of flash available, as well a CPU with an effective clock speed of around 6-12 MHz (the wait states murder the effective performance), the calculator has memory and CPU performance comparable to DOS computers in the 80s, for which C tool chains existed. A carefully designed flash file system using file deltas could even reduce the need for garbage collection of flash. And with a USB port, expanding storage beyond flash and RAM is eminently do-able.

This is not to say it's a good idea, or would be very useful compared to a PC development environment, but it's still possible.
I can understand the desire; when I was younger I neither was allowed all that much access to a PC, nor wanted to use any device except my calculator alone.
  
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 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