Forums Casio - Projets de programmation

Index du Forum > Projets de programmation > C.Basic Projets
Sentaro21
Hors ligne
Membre
Points: 154
Défis: 0
Message
Posté le 30/04/2017 11:08

C.Basic Projets :

Hello, everyone.

I am Sentaro21, and I am developing C.Basic, a Basic interpreter that allows high-speed execution of Basic programs while maintaining compatibility with genuine Casio Basic.

Here is an English site, by Krtyski, about the C.Basic project (I helped him with the translation, but it's still unfinished) :
https://egadget2.web.fc2.com/CBasic/Interpreter/CBasic_interpreter.html

The articles and various programs from this site served as a reference to evaluate the compatibility level of C.Basic. Results were not good every time I tested them, but compatibility increased over time.

These programs have been ported experimentally. Many thanks to their authors.

Block Tower (C.Basic version)
https://pm.matrix.jp/CB/CB_BlockTower.zip

Sudoku (C.Basic version)
https://pm.matrix.jp/CB/CB_Sudoku.zip

Maze Generator (C.Basic version)
https://pm.matrix.jp/CB/CB_Mazegene.zip

Graph 3D (C.Basic version)
https://pm.matrix.jp/CB/CB_Graph3D.zip

Ice slider (C.Basic version 25/11/2018)
https://pm.matrix.jp/CB/CB_IceSlider.zip
(added Save/Load feature)

Clonelab (C.Basic version 25/11/2018)
https://pm.matrix.jp/CB/CB_Clonlab.zip
(added Save/Load feature)

Arkenstone (C.Basic version 25/11/2018)
https://pm.matrix.jp/CB/CB_Arkenstone.zip
(added Save/Load feature)

Aventura (C.Basic version 25/11/2018)
https://pm.matrix.jp/CB/CB_Aventura.zip
(added Save/Load feature)


Here are examples of programs that reach near-C performance :

BallGame (C.Basic version)
https://pm.matrix.jp/CB/CB_BallGame.zip

Asprin (C.Basic version)
https://pm.matrix.jp/CB/CB_Aspirin.zip


The C.Basic project is still yet to be completed, thus I would like to get your feedback.

This is the latest beta version of C.Basic 1.89beta for Graph 35+USB/75/85/95 (SD) : https://pm.matrix.jp/CB/CBASIC189beta.zip (updated 11/12/2018)

This is the latest alpha version of C.Basic for Graph90+E/fx-CG10/20/50:
https://pm.matrix.jp/CB/CBASICCG062.zip (updated 11/12/2018)

Currently C.Basic exists thanks to this site.
Thank you very much.



Lephenixnoir
Hors ligne
Administrateur
Points: 13150
Défis: 136
Message
Dernier message de la page précédente :Posté le 02/07/2017 13:12 |
I don't know of the obscure details of Basic's exotic opcodes and syntax, but I am fairly sure that a properly-implemented typical LR(1) parser for the following kind of grammar could work very well on most (if not all) kinds of expressions.

<expr>    -> <value>
<expr>    -> ( <expr> )
<expr>    -> <unary> <expr>
<expr>    -> <expr> <binary> <expr>

<unary>   -> (-) | Not | etc.
<binary>  -> + | - | × | ÷ | And | Or | etc.
<value>   -> <integer> | <literal-string> | /[A-Zθr]/ | etc.
/* and so on */

Think about how opcodes are operators, and most often right-to-left unary operators followed by the operand. Is there anything this method would miss?

Edit : It seems that @Zezombye has implemented quite the naive parser. No wonder you'd find it difficult.
----------------------------------
Rise.



Pages: Précédente | 1, 2, 3, 4, 5 | Suivante

Sentaro21
Hors ligne
Membre
Points: 154
Défis: 0
Message
Citer : Posté le 02/07/2017 16:59 | #
Zezombye a écrit :
If I understand correctly you are doing binary operations instead of decimal operations? This is very dangerous, because it means that 0.1+0.2 != 0.3 (see http://0.30000000000000004.com/). This could lead to bugs from big programs.

Yes, C.Basic use the library of SDK/C, as for all the operation parts,
and so, the risk is the same as SDK/C.

Zezombye a écrit :
All the code you need is here: http://git.planet-casio.com/Zezombye/B2C/blob/master/B2C/src/B2CFunctions.c
The rest of B2C is just compiling basic to C, it's the parser.
I suggest you put your code on our gitlab : git.planet-casio.com that way I could have a look at it and suggest optimisations.

Thanks!

I failed at gitlab registration.
An email does not come from gitlab.
Please wait a little while more.

Zezombye a écrit :
Indeed it is, and there are a lot of weird opcodes (see http://www.planet-casio.com/Fr/programmes/programme1984-last-clonelab-ne0tux-a3.html which pushes basic to its limits).

This program has not yet worked normally in C.Basic.
It wants to work with rewriting program for current C.Basic.

Zezombye a écrit :
From what I've seen you also want to do a compiler? I think it should be some kind of both (pre-compiling basic programs), doing both an interpreter and a compiler would cost too much time.
Optimisations could be like storing the lines of conditions/loops and gotos/lbls, that way when the interpreter encounters "goto 10" it knows where the lbl 10 is and jumps to it immediately. I think that's why the for loops are so slow.

Because the interpreter system is main,I think that the compiler in C:Basic becomes restrictive.
The optimization of the Goto command implements in C.Basic,
but,Goto is special operation in Casio Basic.(rebuilding of the loop structure stack..)
it is not compatible now.


Lephenixnoir a écrit :
I don't know of the obscure details of Basic's exotic opcodes and syntax,

There is new discovery whenever I watch a program uploaded in CasioPlanet.

How to use DrawStat,
like this "c1","anStart" etc, not normal variable,
How to use Ans and List 1[0] etc.
Dark storm
Hors ligne
Membre d'honneur
Points: 10691
Défis: 174
Message
Citer : Posté le 02/07/2017 17:04 | #
I confirm your GitLab account manually, so you can connect with the username and password you chose at registration
----------------------------------
Finir est souvent bien plus difficile que commencer. — Jack Beauregard
Páranÿe quetë Quendya
Lephenixnoir
Hors ligne
Administrateur
Points: 13150
Défis: 136
Message
Citer : Posté le 02/07/2017 17:16 | #
Sentaro21 a écrit :
There is new discovery whenever I watch a program uploaded in CasioPlanet.

These are of course new functionalities, but not exotic nor even a disturbance for a parser. I was focusing on syntax specifics, eg. an operator placed after its operand.

Now that I think about it, I may have misunderstood you :

About the parser.I think that an expression evaluation is the most difficult.

If you meant evaluating an expression once you have the tree structure of the operation, then it's not really about parsing. But since you're using the native numerical data types, that shouldn't be too much of a burden. So what did you mean exactly?
----------------------------------
Rise.
Sentaro21
Hors ligne
Membre
Points: 154
Défis: 0
Message
Citer : Posté le 03/07/2017 04:15 | #
Lephenixnoir a écrit :
These are of course new functionalities, but not exotic nor even a disturbance for a parser. I was focusing on syntax specifics, eg. an operator placed after its operand.
Now that I think about it, I may have misunderstood you :

I'm sorry, there may be my misunderstanding.

If you meant evaluating an expression once you have the tree structure of the operation, then it's not really about parsing. But since you're using the native numerical data types, that shouldn't be too much of a burden. So what did you mean exactly?

I agree with you about the parser.
Because I was weak in a recursive thought, I felt evaluating an expression was most difficult at first.
However it is understood now.

Ajouté le 03/07/2017 à 04:36 :
Dark storm a écrit :
I confirm your GitLab account manually, so you can connect with the username and password you chose at registration

Thank you for your kindness.
I'm sorry, I cannot yet login and the email does not arrive, too
Lephenixnoir
Hors ligne
Administrateur
Points: 13150
Défis: 136
Message
Citer : Posté le 03/07/2017 09:58 | #
Make sure you log in using your username, sentaro21. If you type in the right password, you'll be able to log in right away and won't need any email.
----------------------------------
Rise.
Sentaro21
Hors ligne
Membre
Points: 154
Défis: 0
Message
Citer : Posté le 03/07/2017 14:12 | #
Lephenixnoir a écrit :
Make sure you log in using your username, sentaro21. If you type in the right password, you'll be able to log in right away and won't need any email.

Though I did not know whether a password was wrong, I was not able to log in today either.
I registered again and an email came,and able to log in now.
I am sorry to have caused trouble.
Thanks very much!

Ajouté le 13/08/2017 à 10:26 :
Hi Lephenixnoir
The top page of C.Basic(by Krtyski) was updated.
Krtyski of my friend can not login to Planet-Casio for some kind of causes.
I express his gratitude to you.
------------------------------------------
Dear Lephenixnoir

I do appreciate for your help on my translation. I have been extremely busy, so it took long time to come back to C.Basic project. I'm currently changing almost all sentences based on your advise.
------------------------------------------

Thank you always for everything.
Lephenixnoir
Hors ligne
Administrateur
Points: 13150
Défis: 136
Message
Citer : Posté le 13/08/2017 22:45 | #
I'm glad to be of some help!

Translating isn't very hard for me, so if there's anything I can help with, feel free to ask. This project deserves great visibility!
----------------------------------
Rise.
Sentaro21
Hors ligne
Membre
Points: 154
Défis: 0
Message
Citer : Posté le 17/06/2018 15:10 | #
Bonjour

I apologize for the long silence.

I'm glad that Python is equipped with this year by GRAPH90+E calculator.
The times are not BASIC, however I'm glad that a newer Casio Basic program is announced.
I think BIDE by Zezombye to be very splendid application.

I continued developing C.Basic.
I added C.Basic newly with complex number and MCS direct access mode.
Therefore it became easier to try application of genuine Casio Basic in C.Basic.

Here is latest updated FX version.
http://pm.matrix.jp/CB/CBASIC180beta.zip


C.Basic for GRAPH+90E/CG50/CG20/CG10 is under development.
I have not yet got the operation check in GRAPH+90E.
If there is a person trying this, I will be glad.

Here is latest updated CG version.
http://pm.matrix.jp/CB/CBASICCG054.zip

I apologize in the manual being still imperfect.

Thanks in advance.
Nemhardy
Hors ligne
Grand maître des Traits d'Esprit
Points: 1232
Défis: 54
Message
Citer : Posté le 17/06/2018 17:19 | #
Hey, it's nice to hear some new stuff from you !

I have just checked on a Graph90+E and everything looks to be working fine so far ! (The test was not very extensive though, but I think that if the main stuff works, there's no reason for the rest not to work, especially if you already know it works well on a CG50, which is very close to the G90+: I'm not aware of any difference other than the name actually… ))

I'm actually wondering whether you think C.Basic's core could be used (and could be worth to be used) to get a Casio Basic's interpreter running on a PC as well… I think that having such a thing together with BIDE could ease Casio Basic dev to a great extent!

I also gave a look to the manual of the CG version, and i'm especially interested in this line :
There is free RAM of 6MB in CG50. C.Basic can use it.
( to use hedden memory by setup )

I'm not sure what I should understand in «hedden memory by setup» actually… ^^'
I'm also interested in how easy it is to access and use those 6MB of RAM, which is quite a big amount! Moreover, LePhenixNoir recently had access and had been able to run some tests on units that were loaded with a newer (and not publicly avalaible yet) version of the OS, that seemed to unlock some megabytes of RAM: the heap looked significantly bigger than on the current versions. Maybe the incomming OS update will interfere with how you are using those extra megs of RAM…

Anyway, this definitely looks worth spending some time playing with it…
----------------------------------
N'attendez pas qu'il n'y ait plus de miel : スススススススススススススススススススススススススス養蜂家スススススススススススススススススススススススススススススススススススス蜂家
Lephenixnoir
Hors ligne
Administrateur
Points: 13150
Défis: 136
Message
Citer : Posté le 17/06/2018 20:16 | #
Hi Sentaro! Hope you're doing well.

We have a habit of reporting news about member projects in a weekly article on Planète Casio's front page. Just as Nemhardy I think C.Basic (and C:Basic in general) deserves more visibility. Would you mind if we present your project in the next publication? If so, then would the link to your website (this one) be a suitable reference?

I have also tested your application on a Graph 90+E. I had a lot of these errors when browsing the storage memory :

Save error
code:48
Press:[EXIT]

It dit not prevent me from using the file manager but I guess I should be reporting it. If you need a dump of my storage memory (for possible weird file/directory names or whatever), I can do one for you.

I also gave a look to the manual of the CG version, and i'm especially intersted in this line :

The presence of additional RAM is very interesting. Currently the heap holds 128k of memory, but the factory test menu of a Graph 90+E equipped with Python revealed that the new heap holds 3M of memory. Which is pretty natural because I doubt Python would run on 128k anyway.

I'm still dabbling in with the Prizm as well, writing some drivers, investigating the memory and the platform, so if you have any reference for this RAM area I'd be interested as well.

Good luck o/
----------------------------------
Rise.
Sentaro21
Hors ligne
Membre
Points: 154
Défis: 0
Message
Citer : Posté le 18/06/2018 11:26 | #
Hi Nemhardy
Thanks very much for checking operation in Graph+90E.
I'm glad to understand that C.Basic works well in Graph90+E.

There was a powerful Prizm users in Japan too.
The recent update has many things by his support.

Nemhardy a écrit :
I'm actually wondering whether you think C.Basic's core could be used (and could be worth to be used) to get a Casio Basic's interpreter running on a PC as well… I think that having such a thing together with BIDE could ease Casio Basic dev to a great extent!

Yes, I think so, too, but do not lead to realization by my inadequacy.


Nemhardy a écrit :
I'm not sure what I should understand in «hedden memory by setup» actually… ^^'
I'm also interested in how easy it is to access and use those 6MB of RAM, which is quite a big amount! Moreover, LePhenixNoir recently had access and had been able to run some tests on units that were loaded with a newer (and not publicly avalaible yet) version of the OS, that seemed to unlock some megabytes of RAM: the heap looked significantly bigger than on the current versions. Maybe the incomming OS update will interfere with how you are using those extra megs of RAM…

Anyway, this definitely looks worth spending some time playing with it…

If it is out of OS management,it is easy to access it directly.
However,
If it is managed by the OS, it will be changed to using SysCALL.




Hi Lephenixnoir
I'm always grateful to your comment.

Lephenixnoir a écrit :
We have a habit of reporting news about member projects in a weekly article on Planète Casio's front page. Just as Nemhardy I think C.Basic (and C:Basic in general) deserves more visibility. Would you mind if we present your project in the next publication? If so, then would the link to your website (this one) be a suitable reference?

Yes, it is all right.
Thank you very much for your help.


Lephenixnoir a écrit :
I have also tested your application on a Graph 90+E. I had a lot of these errors when browsing the storage memory :
Save error
code:48
Press:[EXIT]

Because C.Basic use the main memory of 1832B, C.Basic comes to lack of the main memory.
Please enlarge the free area of the main memory.


Lephenixnoir a écrit :

The presence of additional RAM is very interesting. Currently the heap holds 128k of memory, but the factory test menu of a Graph 90+E equipped with Python revealed that the new heap holds 3M of memory. Which is pretty natural because I doubt Python would run on 128k anyway.

I'm still dabbling in with the Prizm as well, writing some drivers, investigating the memory and the platform, so if you have any reference for this RAM area I'd be interested as well.

Good luck o/

It is nice news that a heap became 3MB !
However it is strange that it is not 6MB.
If the OS manages all of deployment memory, C.Basic will become necessary to change hidden memory managiment.
Because I do not know whether Python appears in CG50,
I'm looking forward to your continued a help.
Dark storm
Hors ligne
Membre d'honneur
Points: 10691
Défis: 174
Message
Citer : Posté le 18/06/2018 12:28 | #
Sentaro21 a écrit :
It is nice news that a heap became 3MB !
However it is strange that it is not 6MB.

Yes, I found this quite strange, because on the factory menu the total amount of RAM available was around 4 Mio, but physically the chip contains 8 Mio.
Anyway, if it's easy to use the 4 Mio that are not used by the system, that's not a problem
----------------------------------
Finir est souvent bien plus difficile que commencer. — Jack Beauregard
Páranÿe quetë Quendya
Lephenixnoir
Hors ligne
Administrateur
Points: 13150
Défis: 136
Message
Citer : Posté le 18/06/2018 13:13 | #
Anyway, if it's easy to use the 4 Mio that are not used by the system, that's not a problem

Oh, yes, it's a problem :
- Is this area really unused?
- Is this method future-proof? What if a future OS version starts using the area?
----------------------------------
Rise.
Sentaro21
Hors ligne
Membre
Points: 154
Défis: 0
Message
Citer : Posté le 18/06/2018 13:47 | #
Dark storm a écrit :
Yes, I found this quite strange, because on the factory menu the total amount of RAM available was around 4 Mio, but physically the chip contains 8 Mio.
Anyway, if it's easy to use the 4 Mio that are not used by the system, that's not a problem

Thanks!
If the free area is 4MB, it is enough quantity for C.Basic


Lephenixnoir a écrit :
Anyway, if it's easy to use the 4 Mio that are not used by the system, that's not a problem

Oh, yes, it's a problem :
- Is this area really unused?
- Is this method future-proof? What if a future OS version starts using the area?

I think the OS not to use 4MB or more.
If it all becomes the OS management I think about it again at the time.

BTW,
The contents of the SDRAM of Graph90+E/CG50 become extinct after Power Off in one hour.
What did you think about this?
Lephenixnoir
Hors ligne
Administrateur
Points: 13150
Défis: 136
Message
Citer : Posté le 18/06/2018 13:52 | #
The contents of the SDRAM of Graph90+E/CG50 become extinct after Power Off in one hour.
What did you think about this?

I would not expect RAM storage to be reliable at all. There is a reason why the OS saves the contents of the main memory to the Flash before powering off.

The fact that some RAM persists after a reboot has been of some help to me in the past, to debug add-in crashes by writing logs to the RAM and inspecting them after the crash.

Then if you need to store data you definitely need to either:
- Store it in main memory (but small space)
- Store it in storage memory (but slow syscalls)
- Heed for calculator shutdowns (but they're invisibly handled inside GetKey())

I think the relevant point is what you are trying to store and what for.
----------------------------------
Rise.
Sentaro21
Hors ligne
Membre
Points: 154
Défis: 0
Message
Citer : Posté le 19/06/2018 11:17 | #
Lephenixnoir a écrit :
I would not expect RAM storage to be reliable at all. There is a reason why the OS saves the contents of the main memory to the Flash before powering off.

The fact that some RAM persists after a reboot has been of some help to me in the past, to debug add-in crashes by writing logs to the RAM and inspecting them after the crash.

Then if you need to store data you definitely need to either:
- Store it in main memory (but small space)
- Store it in storage memory (but slow syscalls)
- Heed for calculator shutdowns (but they're invisibly handled inside GetKey())

I think the relevant point is what you are trying to store and what for.

Thanks!
I pretty much agree.

I think that the backup system of fx series is very excellent.
However,C.Basic of CG50 is rebooted by daily.
Setting and the variable of C.Basic back up in main memory,
but it is so difficult to back up full 6MB to the storage.
I think that there should be the more power-saving mode.


Here is new updated. (re-uploaded)
http://pm.matrix.jp/CB/CBASIC180beta.zip
http://pm.matrix.jp/CB/CBASICCG054.zip
-Fixed Argument( bug that it become "Memory Error".
-Changed specification when a0,a1,a2,anStart,b0,b1,b2,bnStart,c0,c1,c2,cnStart was used,it becomes the extended variable automaticaly.
Lephenixnoir
Hors ligne
Administrateur
Points: 13150
Défis: 136
Message
Citer : Posté le 19/06/2018 15:25 | #
[...] but it is so difficult to back up full 6MB to the storage.

Do you really need 6 MB of memory to be saved between two full sessions of C.Basic ?
----------------------------------
Rise.
Sentaro21
Hors ligne
Membre
Points: 154
Défis: 0
Message
Citer : Posté le 19/06/2018 16:19 | #
.
Lephenixnoir a écrit :
[...] but it is so difficult to back up full 6MB to the storage.

Do you really need 6 MB of memory to be saved between two full sessions of C.Basic ?

I don't think it's necessary to go that far with that.
But I think that it is more convenient if it does not disappear.
Lephenixnoir
Hors ligne
Administrateur
Points: 13150
Défis: 136
Message
Citer : Posté le 19/06/2018 18:25 | #
I tried your last version with more free space in my Main Memory: it worked a lot better.

Your bitmap example also runs very nicely. Good job!
----------------------------------
Rise.
Sentaro21
Hors ligne
Membre
Points: 154
Défis: 0
Message
Citer : Posté le 21/06/2018 08:51 | #
Thanks very much for trying

The FX version is near to the last for the interpreter version.
However,
If the Prizm version is developing still more,
I would appreciate it very much if you could point out anything to me.


Here is new updated. (re-uploaded 21/6/2018)
http://pm.matrix.jp/CB/CBASIC180beta.zip
http://pm.matrix.jp/CB/CBASICCG054.zip

Pages: Précédente | 1, 2, 3, 4, 5 | Suivante

Index du Forum > Projets de programmation > C.Basic Projets

Planète Casio v42 © créé par Neuronix et Muelsaco 2004 - 2018 | Il y a 23 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements

Planète Casio est un site communautaire indépendant, géré bénévolement et n'est donc pas affilié à Casio | Toute reproduction de Planète Casio, même partielle, est interdite
Les fichiers, programmes et autres publications présents sur Planète Casio restent la propriété de leurs auteurs respectifs et peuvent être soumis à des licences ou des copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd