Join us on Discord!
You can help CodeWalrus stay online by donating here.
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - PT_

#316
Quote from: Cumred_Snektron on March 25, 2016, 01:50:49 PM
Interesting project. I've had a few stabs at a CE language too, with C using a parser generator called leg (http://piumarta.com/software/peg/peg.1.html)
A few obstacles i encountered were:
- i wanted to ideally use the ZDS routines. Due to the register arguments they take (HL and BC) it became impossible to do a proper precedence based expression
compiler, since it would need complex register allocation or a lot of useless swaps
- A CE lang would need to be compatible with other C routines, which would add the problem of types.
- I got frustrated with the C SDK since the makefile makes a lot of mess.

I've implemented a non precedence based expression compiler, which works.

What types of variables are you going to implement? floats, ints or ti's floats?

im interested in how this will turn out :)
Yea, that is why I started with this project, and I hope to make good progress within weeks!
Like Axe, I'm going to work with ints, and MAYBE with floats, but then only for numbers, and not lists or eventually matrices.

But a difference is, that you get an element of L1, you need this: {L1+5} or whatever. I will just allow L1(5), like BASIC programmers already do :)
#317
Programs and Utilities / [TI-84+CE] ICE Compiler
March 25, 2016, 08:14:17 AM
Hello everyone!

I can imagine many, many people are waiting for this post, but yeah, one must be the first to start such project ;)
I want to introduce this program:

ICE - an interpreter/compiler of CE-BASIC

Hooray! It would look like Axe Parser, but then for the newest calculator, the TI-84+CE.
Now are there many people who have questions, about what is possible with it, how long would it take to complete, what are the pros/cons?
Let me answer some questions.

What is ICE?
ICE is an interpreter/compiler of CE-BASIC. Normally, the OS reads a BASIC programs, and compiles it to some ASM commands, and then execute it. ICE does almost the same, but only read it, and compiles it to ASM commands, but instead of executing, it stores them into another program! In that way, you can turn your BASIC program into an ASM one, which is 1000x faster.

Why ICE?
Because I want to make a cool project (and not only games), and I think this program would be very useful for many people, so I decided to give it a try :)

What is possible with ICE?
I've no details yet, because I'm in an early stage, but I want to make it possible to keep it as BASIC as possible. I mean, you should be able in the future to compile all the BASIC programs to ASM. I never gonna reach that.... Like Axe Parser, it doesn't work with the TI-OS variables, because they are sloooowwwww. Instead, all the variables are in the RAM.

What are the pros and cons of ICE?
You can compile almost all the BASIC programs to ASM, which is 1000x faster. Since the CE has a memory-mapped screen, I'm going to implement a bunch of graph routines as well. A disadvantage is that you're a bit limited with the BASIC commands. I hope I can explain this later

When will you finish it?
In these weeks, I'm busy with school stuff, so I can't really do something with programming. But after that, I hope to finish it as fast as possible. Depending on the difficulties, I hope to finish it in some monts :)

How works ICE?
The hardest part is to express a string (and eventually store it to a variable). I will implement the Shunting-Yard-Algorithm for that (I will explain later). Once I got that ready, I need to write routines that replaces BASIC commands, like ClrHome would be call _HomeUp / call _ClrTxtShdw or whatever. Once THAT is ready, or enough of them, I will release a beta :)`

How smart is ICE?
For now, it is pretty smart, and by "smart" I mean, that if you display 2 strings which are exactly the same, it will be only once in RAM, an example:
Disp "ICE","ICE"
would be this:
   call _NewLine
   ld hl, _pointer_disp_0
   call _PutS
   call _NewLine
   ld hl, _pointer_disp_0
   call _PutS
   ret

_pointer_disp_0:
   .db "ICE", 0

which saves some RAM.

Example of Shunting-Yard-Algorithm:
Let's say I have this code:
F/2+3->A
The algorithm converts this to:
F 2 / 3 + A ->
Now I gonna read this sentence, and convert it to this (for example code)
   ld a, (address_of_variable_F)
// Now I now that I need to divide A by 2, which is a power of 2, so just rotate the byte
   or a
   rra
// Now to add 3, which is a value, not a variable
   add a, 3
// Now store it to variable A, so
   ld (address_of_variable_A), a

This is basically how the algorithm works, but then a bit more complicated :P especially when you have a long string.

Progress:
As some of you may know, it's very hard to work in ASM :P. That is why I decided to first create this in PHP (that's why I asked how to read .8xp with PHP). After I finished that, I will port it to ASM. I'm now in the stage for developing the Shunting-Yard-Algorithm, which is the main and hardest part.

I know,  there are still a ton of questions, so feel free to ask anything if you don't understand it, or whatever you want to say! :)


Psst, don't mind my English, I'm only a sweet Dutch boy :D


Originally posted on Cemetech: https://www.cemetech.net/forum/viewtopic.php?t=12616






Current version: 1.2.1
========DOWNLOAD========
Download ICE Compiler
#318
Hello!

I'm PT_, and an active member of Cemetech and sometimes TIPlanet as well. Now had I made a nice project, so DJ_O said to me to post it on CodeWalrus as well, so yeah, that is what I'm trying :D
Powered by EzPortal