En cette période de Bac, retrouvez notre sélection de programmes. De plus, nous vous conseillons de ne pas vous y prendre au dernier moment, le site peut être indisponible suite à une surcharge de visiteurs.
Forums Casio - Projets de programmation

Index du Forum > Projets de programmation > C.Basic Projets
Sentaro21
Hors ligne
Membre
Niveau: Aucun
Points: 97
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) :
http://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)
http://pm.matrix.jp/CB/CB_BlockTower.zip

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

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

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

Tokitori (C.Basic version 3/6/2017)
http://pm.matrix.jp/CB/CB_Tokitori.zip

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

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

Asprin (C.Basic version)
http://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.80beta for Graph 35+USB/75/85/95 (SD) : http://pm.matrix.jp/CB/CBASIC180beta.zip (updated 17/6/2018)

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



Lephenixnoir
Hors ligne
Administrateur
Niveau: Confirmé
Points: 11464
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

Sentaro21
Hors ligne
Membre
Niveau: Aucun
Points: 97
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
Administrateur
Niveau: Aucun
Points: 10256
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
Niveau: Confirmé
Points: 11464
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
Niveau: Aucun
Points: 97
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
Niveau: Confirmé
Points: 11464
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
Niveau: Aucun
Points: 97
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
Niveau: Confirmé
Points: 11464
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
Niveau: Aucun
Points: 97
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
Niveau: Confirmé
Points: 1192
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…
----------------------------------
Ils n'osent pas s'avouer que c'est à cause de rien du tout…
Lephenixnoir
Hors ligne
Administrateur
Niveau: Confirmé
Points: 11464
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.

Pages: Précédente | 1, 2

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

Planète Casio v42 © créé par Neuronix et Muelsaco 2004 - 2018 | Il y a 37 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