So, I have been throwing the idea of an on-calc programming language that can be compiled into binaries and run as normal programs. I first looked at basic languages, they could work. I will not have the ease of variable access as with official OSes as GlassOS doesn't have global variable storage. I looked at old versions of FORTRAN, but the formatting of the language was killer and wouldn't be nice to type out on-calc. I recently looked at MLC and can use the basis of the language and change up the functions and goal of the language.

But I am not skilled enough with a wide range of languages. Anyone know of nice, simple languages that can be compiled into machine code? I am not 100% on the boat with interpreted languages or virtual machines running... C compilers are out of the question. Razz

The scope of the language isn't to be compatible with TI or Casio calcs, nor is it there to do loads of math things.
Is there any reason why you couldn't port another widely used language for your OS, such as Axe or Grammer? Why is a C compiler out of the question, anyways?
I'd personally recommend something like BBC BASIC, as that's a great mix of high- and low-level features (see its indirection operators for direct memory access, GET and PUT for port I/O and the inline assembler). It is not usually compiled but generating threaded code should not be too tricky.
Kaslai wrote:
Is there any reason why you couldn't port another widely used language for your OS, such as Axe or Grammer?


Both of those languages are very highly dependent on TI-OS's design, so they probably couldn't be options.
In my opinion, you should use a lower-level version of TI83+ basic since almost every TI programmer knows. By lower-level, I mean stuff like:

Quote:
* storing to an address instead of a variable like [8000:2] (where the first # is the address and the second # is the # of bytes); or [0:4000:4] where the first # is the page number, the second is the address, and the third is the number of bytes.
* port io functions
* definition of re-writable labels like SPACE[256]: where the 256 is the number of bytes. undefined memory areas could be preceded by a question mark ?SPACE[256]: The basic idea is to allow program writeback.


These are just some ideas you might not think about if you did it that way, obviously you'd add support for functions like sprite drawing, menu creation, etc.
---------------------------------------------------

SCRATCH THAT

Just realize you were wanting to use a compilable language, not an interpreted. I'd suggest Javascript cuz everyone knows it. Plus, you can use google code to check out V8 if you need help.
I'm with Ben. Either BBC BASIC or some other flavor of BASIC (you said you looked as BASIC, I assume you meant you looked at "TI-BASIC", which, I'm surprised Ben didn't point out, isn't BASIC).
Anakclusmos wrote:
Just realize you were wanting to use a compilable language, not an interpreted. I'd suggest Javascript cuz everyone knows it. Plus, you can use google code to check out V8 if you need help.
Javascript is compiled.. how? JIT compilation works, but static compilation is impossible due to the language's dynamic typing. Implementing a JIT on a Z80 sounds like it would be pointlessly inefficient, as well.

I rather like the idea of Lisp, since it has a long history and basic implementations are fairly easy, but some BASIC variant is probably friendlier to users.
I don't know too many programming languages, but I do see the reasoning of having an on-calc programming language. I also like the idea of modeling after TI-Basic, but instead of using global variable storage, use stack/heap allocation for temp storage, and clear those areas when you're done. If you want to save files, add commands for saving and loading.
Tari wrote:
Anakclusmos wrote:
Just realize you were wanting to use a compilable language, not an interpreted. I'd suggest Javascript cuz everyone knows it. Plus, you can use google code to check out V8 if you need help.
Javascript is compiled.. how? JIT compilation works, but static compilation is impossible due to the language's dynamic typing. Implementing a JIT on a Z80 sounds like it would be pointlessly inefficient, as well.

I rather like the idea of Lisp, since it has a long history and basic implementations are fairly easy, but some BASIC variant is probably friendlier to users.


Google Chrome assembles Javascript with V8 (which is open source) and Unity3D uses javascript as one of it's languages. Of course, Unity may package the game engine with a javascript interpreter, but I know for certain that V8 is a compiler.
Anakclusmos wrote:
Google Chrome assembles Javascript with V8 (which is open source) and Unity3D uses javascript as one of it's languages. Of course, Unity may package the game engine with a javascript interpreter, but I know for certain that V8 is a compiler.

V8 docs wrote:
During initial execution of the code for accessing a property of a given object, V8 determines the object's current hidden class. V8 optimizes property access by predicting that this class will also be used for all future objects accessed in the same section of code and uses the information in the class to patch the inline cache code to use the hidden class. If V8 has predicted correctly the property's value is assigned (or fetched) in a single operation. If the prediction is incorrect, V8 patches the code to remove the optimisation.

A JIT by any other name...
Tari wrote:
I rather like the idea of Lisp, since it has a long history and basic implementations are fairly easy, but some BASIC variant is probably friendlier to users.


I find this suggestion to be great; Lisp is a pretty straightforward language, and I'm sure it wouldn't be too hard to make a minimal compiler for a lower-level form of it. However, I also like the BBC Basic idea; perhaps you could start with the BBC basic port? There's a CP/M implementation online somewhere, and Benryves even made a TI-OS port of it. Haven't looked at the sources at all to see if it would be easy for you to pick up and port in no time flat, but I would suggest it would be easier than writing a compiler for another language from scratch.
merthsoft wrote:
I'm with Ben. Either BBC BASIC or some other flavor of BASIC (you said you looked as BASIC, I assume you meant you looked at "TI-BASIC", which, I'm surprised Ben didn't point out, isn't BASIC).
I third the BBC BASIC suggestion most heartily. Not to mention that if you asked nicely I bet BenRyves might be willing to throw some knowledge or some code in your direction.
When I said I looked at basic, I meant actual basic, not TI-BASIC. Languages that depend on TI-BASIC would require me to make the language, but not interprit it on-calc, which seems like a major waste that one language requires another.

@Ashbad, yes, I do see how these languages are based off of TIOS. For ex, OS functions are limited and rely on the use of libraries. Also, the tokens used in TIOS, like math related ones, would not seem right in GlaßOS as the math parts are not in the OS.

@Tari, I did look at lisp for a while as a usable language. I guess I need to learn it more to see how well it would work on-calc. And Actionscript (I hope nobody wants to talk about Java...) would seem a tad odd to type and compile on a calc...

I will go and poke around BBC basic for a bit
Tari wrote:
I rather like the idea of Lisp, since it has a long history and basic implementations are fairly easy, but some BASIC variant is probably friendlier to users.

I strongly suggest this! Lisp is quite easy to implement, and its structure is awesome. Although, I'd probably say that Scheme is even better, because it is more minimal than Lisp is (And, you know, first class functions <3). That said, I'm biased, so...

If not Lisp or Scheme, then I'd also promote BBC BASIC, as it's already been done (Unless you are wanting to write the whole thing yourself).

Edit: Also, typing that many parentheses might get annoying on-calc, so that's another downside to Scheme or Lisp.
I like the idea of lisp or scheme as well, but I think that OPIA would be pretty easy to port, as well, once it is complete. shka's designed it so that it will work on all of the z80 calcs.
Note that GlassOS's key map is different.

I was thinking about taking parts of MLC and BBC basic and making my own language.
  
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