Les membres ayant 30 points peuvent parler sur les canaux annonces, projets et hs du chat.
La shoutbox n'est pas chargée par défaut pour des raisons de performances. Cliquez pour charger.

Forum Casio - Projets de programmation


Index du Forum » Projets de programmation » C.Basic Projets
Sentaro21 Hors ligne Membre Points: 878 Défis: 0 Message

C.Basic Projets

Posté le 30/04/2017 11:08

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

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

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)

Electricity (C.Basic version 10/2/2019)
https://pm.matrix.jp/CB/CB_Electric.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 version of C.Basic 2.47 beta for Graph 35+USB/35+EII/75/85/95 (SD)
https://pm.matrix.jp/CB/CBASIC247beta02.zip (updated 11/12/2023)

This is the latest version of C.BasicCG 1.47 beta for Graph90+E/fx-CG10/20/50:
https://pm.matrix.jp/CB/CBASICCG147beta02.zip (updated 11/12/2023)

C.Basic manuals
https://gitlab.com/sentaro21/cbasic

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


1, 2, 3, 4 ··· 10 ··· 20 ··· 30, 31, 32 Suivante
Lephenixnoir Hors ligne Administrateur Points: 24581 Défis: 170 Message

Citer : Posté le 30/04/2017 11:25 | #


I had known a few things about this project for a while, but I admittedly never looked for the details. This website is really interesting. But how do you plan to get C:Basic 10 times faster if some of the C.Basic-ported programs already near C performance ? =p

So if I get it correctly, C.Basic is a Basic interpreter, and it is the first stage of a larger project, which is C:Basic, a Basic compiler ? That would be a very interesting work.

If you don't mind, I could improve the English translation of this post and, if it can ever help, of some parts of the website.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Cakeisalie5 Hors ligne Ancien administrateur Points: 1960 Défis: 11 Message

Citer : Posté le 30/04/2017 12:00 | #


I had a look at the time, but I was disappointed by one thing : you didn't keep the controls from the original PRGM application from CASIO (that are in my physical memory). Did you correct this ?
Respirateur d'air, BDFL de Cahute, des utilitaires de communication pour calculatrices CASIO.


Mon blogMes autres projets
Sentaro21 Hors ligne Membre Points: 878 Défis: 0 Message

Citer : Posté le 30/04/2017 12:48 | #


Lephenixnoir a écrit :
I had known a few things about this project for a while, but I admittedly never looked for the details. This website is really interesting. But how do you plan to get C:Basic 10 times faster if some of the C.Basic-ported programs already near C performance ? =p

So if I get it correctly, C.Basic is a Basic interpreter, and it is the first stage of a larger project, which is C:Basic, a Basic compiler ? That would be a very interesting work.

Thanks Lephenixnoir,

Yes,
The final goal is C:Basic that is including native Basic compiler.
Therefore current C.Basic is harfway down the road to goal.
(I think about the compilation only for subprograms now.)

Lephenixnoir a écrit :
If you don't mind, I could improve the English translation of this post and, if it can ever help, of some parts of the website.

I am very grateful,best regards.



Cakeisalie5 a écrit :
I had a look at the time, but I was disappointed by one thing : you didn't keep the controls from the original PRGM application from CASIO (that are in my physical memory). Did you correct this ?

Thanks Cakeisalie5,

Does it mean that C.Basic treat original PRGM application directly ?
Then it is not yet.

Sorry,
Would you explain it in more detail?
Je continue à développer C.Basic. (Il est compatible avec Basic Casio.)
Overclocking utilitaire Ftune/Ptune2/Ptune3 est également disponible.
Si vous avez des questions ou un rapport de bogue, n'hésitez pas à me le faire savoir.
Cakeisalie5 Hors ligne Ancien administrateur Points: 1960 Défis: 11 Message

Citer : Posté le 30/04/2017 12:54 | #


For example, in the original PRGM application, when I want to access Locate, I'm doing Shift, vars, F6, F4, F1, and I'm used to that combination. But that's something I can't use in C.Basic, as the combinations are different. :/

Also, is there no way to use the main memory instead of the storage memory?
Respirateur d'air, BDFL de Cahute, des utilitaires de communication pour calculatrices CASIO.


Mon blogMes autres projets
Ninestars Hors ligne Membre Points: 2462 Défis: 24 Message

Citer : Posté le 30/04/2017 13:23 | #


Hey ! I am the author of Block Tower, so i am glad my game was useful to this project !

So I tried to launch my game with C.Basic, but I have a syntax error.
I downloaded the G1A C.Basic and the four G1M on the storage memory, I open BLOCKT from C.Basic.
the syntax error appers at "Deg:", I replaced : by a new line but still have a syntax error.

Contrary to Cakeisalie5, the editor is very user friendly ! The way to find functions is clear and quick. Also there are a lot of new features, like the scrolling indicator, locking A<>a, MonochromeLib, jumping on line X, new fonctions.
But also bugs... CONT Trce, Step, ... raise a syntaxe error, Skp(bottom arrow) sometimes does not work and switch the tab.
What is the difference when the top line is black or white ?
Lephenixnoir Hors ligne Administrateur Points: 24581 Défis: 170 Message

Citer : Posté le 30/04/2017 14:27 | # | Fichier joint


The website states that C.Basic is compatible with both fx-9860G and fx-9860G II. If I'm not wrong, it means that it can run on both SH7355/SH7337 and SH7305. Is it right?

Sentaro21 a écrit :
Lephenixnoir a écrit :
If you don't mind, I could improve the English translation of this post and, if it can ever help, of some parts of the website.

I am very grateful,best regards.

Ok, I just rephrased your post here.

I also attached to this post is an "improved" (or so I hope) version of the English text found on the page you linked. I believe that I was able to make it at least clearer; feel free to pick up any part of it if you like.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Sentaro21 Hors ligne Membre Points: 878 Défis: 0 Message

Citer : Posté le 30/04/2017 15:21 | #


Cakeisalie5 a écrit :
For example, in the original PRGM application, when I want to access Locate, I'm doing Shift, vars, F6, F4, F1, and I'm used to that combination. But that's something I can't use in C.Basic, as the combinations are different. :/

Yes, understood.
The command input method comes from fx-5800P that's popular in Japan.
If there are many agreement of the original command input method, I'll consider it.

Cakeisalie5 a écrit :
Also, is there no way to use the main memory instead of the storage memory?

I'm considering implementing it.


Ninestars a écrit :
Hey ! I am the author of Block Tower, so i am glad my game was useful to this project !

Thanks Ninestars
I might not implement DrawStat without your Brock Tower and article.
Thanks very much!

As for the cause to become the error, is a version of C.Basic old?
Please try it with the recent version.
(The most recent version is 1.42beta)

Ninestars a écrit :
What is the difference when the top line is black or white ?

White is normal.
Black is indication of the debugging mode.



Lephenixnoir a écrit :
The website states that C.Basic is compatible with both fx-9860G and fx-9860G II. If I'm not wrong, it means that it can run on both SH7355/SH7337 and SH7305. Is it right?

Yes!
C.BASIC supports from 9860G(SH3) to 9860GII-2(SH4A).

Lephenixnoir a écrit :
Ok, I just rephrased your post here.

Thanks very much.

Lephenixnoir a écrit :
I also attached to this post is an "improved" (or so I hope) version of the English text found on the page you linked. I believe that I was able to make it at least clearer; feel free to pick up any part of it if you like.

English site that Krtyski of my friend manages and makes, presently,updates are suspended.because he is very busy now.
I'll tell him it.
Thanks very much again.

Ajouté le 07/05/2017 à 09:33 :
Bonjour,

I implemented command input-style same as original (fx-9860G style).

http://pm.matrix.jp/CB/CBASIC150beta.zip

v1.50beta 2017.5.7
-supported Standard command input method.
You can select Standard(fx-9860G) method or C.Basic(fx-5800P) method from the setup.
Please refer to Command_List.txt for the command that is supported.

-supported *Row,*Row+,Row+
Je continue à développer C.Basic. (Il est compatible avec Basic Casio.)
Overclocking utilitaire Ftune/Ptune2/Ptune3 est également disponible.
Si vous avez des questions ou un rapport de bogue, n'hésitez pas à me le faire savoir.
Cakeisalie5 Hors ligne Ancien administrateur Points: 1960 Défis: 11 Message

Citer : Posté le 07/05/2017 21:24 | #


Nice! A little hidden, but still cool. Do you think you can use the standard function keys from the system, in order to let the calculator manage the localization, and eventually put the C.Basic ones in a G1N? Here is the documentation to use it:

- 19x8 pixels, encoded as 28x8 pixels;
- Simon Lothar - auxiliary functions
- (missing a function key -- role correspondance, I'll ask Simon about that)
Respirateur d'air, BDFL de Cahute, des utilitaires de communication pour calculatrices CASIO.


Mon blogMes autres projets
Sentaro21 Hors ligne Membre Points: 878 Défis: 0 Message

Citer : Posté le 08/05/2017 05:24 | #


Thanks Cakeisalie5

It is a very good plan.
Here is C.Basic program to display the standard function keys icon.
http://pm.matrix.jp/CB/FKEYICON.txt
It seem to be able to do.

I'll update it in the next version.
Thank you for the valuable proposal.


Je continue à développer C.Basic. (Il est compatible avec Basic Casio.)
Overclocking utilitaire Ftune/Ptune2/Ptune3 est également disponible.
Si vous avez des questions ou un rapport de bogue, n'hésitez pas à me le faire savoir.
Nemhardy Hors ligne Grand maître des Traits d'Esprit Points: 1243 Défis: 54 Message

Citer : Posté le 08/05/2017 07:00 | #


I don't know if that is what you meant by “function key -- role correspondance”, but I did this chart some time ago, I admit that's not the more practical presentation though.

(http://www.planet-casio.com/Fr/forums/topic13553-1-[C]_-_Les_Fkeys_Icons.html)
Cakeisalie5 Hors ligne Ancien administrateur Points: 1960 Défis: 11 Message

Citer : Posté le 08/05/2017 12:04 | #


That's exactly it! Nemhardy, the hero of our time <3

By the way sentaro21, do you manage this project publicly somewhere, using a VCS?
Respirateur d'air, BDFL de Cahute, des utilitaires de communication pour calculatrices CASIO.


Mon blogMes autres projets
Sentaro21 Hors ligne Membre Points: 878 Défis: 0 Message

Citer : Posté le 08/05/2017 15:37 | #


Nemhardy a écrit :
I don't know if that is what you meant by “function key -- role correspondance”, but I did this chart some time ago, I admit that's not the more practical presentation though.

(http://www.planet-casio.com/Fr/forums/topic13553-1-[C]_-_Les_Fkeys_Icons.html)

I have seen that picture before.
I'm sorry. because I had been developing with only original Fkey icon for a long time, I fogot it.
Haowever,the system Fkey icon is necessary now,
It is very convenient.
Tnanks Nemhardy

Cakeisalie5 a écrit :
By the way sentaro21, do you manage this project publicly somewhere, using a VCS?

I'm sorry, I haven't thought about that yet.

About G1N,
I don't understand G1N system well.
I'll try it in the same way as the expansion of the command.


Je continue à développer C.Basic. (Il est compatible avec Basic Casio.)
Overclocking utilitaire Ftune/Ptune2/Ptune3 est également disponible.
Si vous avez des questions ou un rapport de bogue, n'hésitez pas à me le faire savoir.
Cakeisalie5 Hors ligne Ancien administrateur Points: 1960 Défis: 11 Message

Citer : Posté le 08/05/2017 15:39 | #


Normally you don't have to manage G1N yourself, the system manages them, and you can select the current one as you can select the current language : in the "Message Language" menu (settings), select F6, the "Menu Language" is basically the used G1N.
Respirateur d'air, BDFL de Cahute, des utilitaires de communication pour calculatrices CASIO.


Mon blogMes autres projets
Sentaro21 Hors ligne Membre Points: 878 Défis: 0 Message

Citer : Posté le 08/05/2017 16:05 | #


I got it. Thanks

Ajouté le 11/05/2017 à 15:02 :
Here is new version.
http://pm.matrix.jp/CB/CBASIC151beta.zip

v1.51beta 2017.5.11
-To changed the icon of the function keys to the system icon.
-supported GCD(,LCM(

There is no change in the icon of the extended command.


Ajouté le 16/05/2017 à 16:18 :
A bug was found,
Here is updated version.
http://pm.matrix.jp/CB/CBASIC152beta.zip

v1.52beta 2017.5.16
-Fixed bugs, When "" double quotation was not closed in Locate and Text command, the following program became handled as character string.
-supported RanNorm#(,RanBin#(

If there's anything you are unclear on,
Please feel free to ask more.


Ajouté le 27/05/2017 à 12:02 :
Some new bugs was found,
Here is updated version.
http://pm.matrix.jp/CB/CBASIC153beta.zip

v1.53beta 27/05/2017
-Fixed StrRight bugs
(example) StrRight("12345",0)
It was right to become the null string, but became "5".
-Fixed acos bugs for list calc.
-Fixed Graph Y=Yn bugs.
-Fixed text conversion bugs when double quotes(") was escaped by character string.
-To be able to use the small letter for The Lbl command.

Ajouté le 03/06/2017 à 11:59 :
Bonjour,
Here is new updated version.
http://pm.matrix.jp/CB/CBASIC154beta.zip

v1.54beta 03/06/2017
-Fixed the multiplication of the Matrix. ( It always became the integer result )
-Fixed 2 Plot & Line bugs.
-To stored Pict file in the hidden RAM area.
-To added setting & command option to store at the same time to storage memory by Pict file preservation.
(sample) Pict #20
This prefix(#) is store to storage memory option.
-To displayed the progress bar at the conversion from text file.


I ported Toritori.
Tokitori (C.Basic version)
http://pm.matrix.jp/CB/CB_Tokitori.zip

Because I am stranded with the sixth side, the later operation check is not done.

The advantage of C.Basic can reduce the power consumption at Getkey->Getkey2.
It becomes the about the same consumption with the idle.

Ajouté le 11/06/2017 à 12:43 :
Here is new updated version.
http://pm.matrix.jp/CB/CBASIC155beta.zip

v1.55beta 12/06/2017
-Added ? command option function.
(usage) ?([x][,y][,width][,SpaceChar][,R])
(example) "A="?()->A
dispay "A=" then wait for input A value. this is like "Input" by TI-Basic.
(example) "A="?(,,,,R)->A
dispay "A=" then wait for input A value reversed display.
(example) "A="?(,,8,,R)->A
dispay "A=" then wait for input A value only 8 digits reversed display.
(example) ?(3,4,5,">")A
dispay "A=" then wait for input A value at(X=3,Y=4) only 5 digits and the blank is made up in ">".
(example) ?(3,4,5,,R)A
dispay "A=" then wait for input A value at(X=3,Y=4) only 5 digits reversed display.

-Fixed AxesOn bugs.
-Fixed _PixelTest bug.(updated)
Je continue à développer C.Basic. (Il est compatible avec Basic Casio.)
Overclocking utilitaire Ftune/Ptune2/Ptune3 est également disponible.
Si vous avez des questions ou un rapport de bogue, n'hésitez pas à me le faire savoir.
Cakeisalie5 Hors ligne Ancien administrateur Points: 1960 Défis: 11 Message

Citer : Posté le 11/06/2017 12:51 | #


Sorry for not following your project as much as it deserves, I'm doing things on my side and stuff, but thanks a lot for making this!
Respirateur d'air, BDFL de Cahute, des utilitaires de communication pour calculatrices CASIO.


Mon blogMes autres projets
Sentaro21 Hors ligne Membre Points: 878 Défis: 0 Message

Citer : Posté le 11/06/2017 13:07 | #


Thank you for your kind comments.

There is a long way to go.
I will do my best.

Merci beaucoup.

Ajouté le 01/07/2017 à 04:44 :
Bonjour,
Here is new updated version.
http://pm.matrix.jp/CB/CBASIC156beta.zip

v1.56beta 30/06/2017
-Added the setting that no updating screen by setting 0 to the RefrshTime.
You can use it by setup and the command.
(example) RefrshCtrl 2
RefrshTime 0
The text and graphics command do not update a screen.

-Added the TicksWait command that waited by 1/128s ticks.
(The TicksWait command connects both "Ticks" and "Wait" command.)
(concerning this, changed part of key assignment.)
(example) TicksWait 128
Wait 1 second.
(example) TicksWait -128
Wait for 1 second from the last TicksWait command run.
When it has been already over 1 second, to the next processing without waiting.
(example) TicksWait -4
Wait for 4/128 second from the last TicksWait command run.
You can make 32fps of loops just to use one this command in the loop.
Je continue à développer C.Basic. (Il est compatible avec Basic Casio.)
Overclocking utilitaire Ftune/Ptune2/Ptune3 est également disponible.
Si vous avez des questions ou un rapport de bogue, n'hésitez pas à me le faire savoir.
Zezombye Hors ligne Rédacteur Points: 1756 Défis: 13 Message

Citer : Posté le 01/07/2017 05:14 | #


Hi, your project seems to be doing well

I'm working on a similar thing (B2C) which, instead of interpreting basic, compiles basic to C in order to run even faster. I think it's more or less as advanced as yours (supports lists, matrices, strings, basic operators and instructions) though I will probably abandon it since I don't know how to code a parser (I've been stuck on implicit multiplication because of spaghetti code).

I was wondering if you modified the strings to run in O(1) instead of O(n), this could increase the speed. I think you already know what I'm speaking about but to be sure, let's take the string "p¤s". In casio encoding it gives "0x70, 0xE5, 0x9B, 0x73" since '¤' is 0xE59B. The string is composed of 4 bytes but only 3 characters, so it can't have access to the n-th character like an array because the characters aren't all of the same size. So StrMid(Str 1, 1, 1) is quicker than StrMid(Str 1, 240, 1).

The solution is simply to have the strings store characters as shorts (2 bytes) instead of 1/2 bytes. This allows more speed, at the cost of more storage space (but it's only 255 bytes more at most).

If you want you can see my code here: http://git.planet-casio.com/Zezombye/B2C/blob/master/B2C/src/B2CFunctions.c

Also, what kind of optimisations do you do? Do you rely on the casio interpreter for operations or do you implement the algorithm yourself?

If you want I could work with you on this project, parsing casio basic is hard to do with all the opcodes and the weird encoding
Divers jeux : Puissance 4 - Chariot Wars - Sokoban
Ecrivez vos programmes basic sur PC avec BIDE
Sentaro21 Hors ligne Membre Points: 878 Défis: 0 Message

Citer : Posté le 02/07/2017 11:05 | #


Zezombye a écrit :
Hi, your project seems to be doing well

I'm working on a similar thing (B2C) which, instead of interpreting basic, compiles basic to C in order to run even faster. I think it's more or less as advanced as yours (supports lists, matrices, strings, basic operators and instructions) though I will probably abandon it since I don't know how to code a parser (I've been stuck on implicit multiplication because of spaghetti code).

Hi,
I saw your B2C and BIDE project.
I feel it to be very stouthearted as a comrade going to a similar thing.
About the parser.I think that an expression evaluation is the most difficult.


Zezombye a écrit :
I was wondering if you modified the strings to run in O(1) instead of O(n), this could increase the speed. I think you already know what I'm speaking about but to be sure, let's take the string "p¤s". In casio encoding it gives "0x70, 0xE5, 0x9B, 0x73" since '¤' is 0xE59B. The string is composed of 4 bytes but only 3 characters, so it can't have access to the n-th character like an array because the characters aren't all of the same size. So StrMid(Str 1, 1, 1) is quicker than StrMid(Str 1, 240, 1).

The solution is simply to have the strings store characters as shorts (2 bytes) instead of 1/2 bytes. This allows more speed, at the cost of more storage space (but it's only 255 bytes more at most).

If you want you can see my code here: http://git.planet-casio.com/Zezombye/B2C/blob/master/B2C/src/B2CFunctions.c

You're right.
Because encoding of Casio Basic is a burden of the speedups,the processing speed of the string does not pursue it.
However I think that it is a good plan to keep the size information of the character code.
I will refer to it.


Zezombye a écrit :
Also, what kind of optimisations do you do? Do you rely on the casio interpreter for operations or do you implement the algorithm yourself?

Because C.Basic was all binary arithmetic operation (not decimal),and pursuit of the speed,
I simulated pure specifications originally without depending on the casio interpreter.
I try some temporizing optimization.
But it is limited for compatibility of Casio Basic.


Zezombye a écrit :
If you want I could work with you on this project, parsing casio basic is hard to do with all the opcodes and the weird encoding

You're very kind.
Please let the work on this project by exchanging the status reports with each other.
If there is a code to be usable in the source of C.Basic (better than an assembler..), please use it.
Thank you in advance for your help.
Je continue à développer C.Basic. (Il est compatible avec Basic Casio.)
Overclocking utilitaire Ftune/Ptune2/Ptune3 est également disponible.
Si vous avez des questions ou un rapport de bogue, n'hésitez pas à me le faire savoir.
Zezombye Hors ligne Rédacteur Points: 1756 Défis: 13 Message

Citer : Posté le 02/07/2017 11:39 | #


Because C.Basic was all binary arithmetic operation (not decimal),and pursuit of the speed,
I simulated pure specifications originally without depending on the casio interpreter.
I try some temporizing optimization.
But it is limited for compatibility of Casio Basic.


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.

Please let the work on this project by exchanging the status reports with each other.
If there is a code to be usable in the source of C.Basic (better than an assembler..), please use it.
Thank you in advance for your help.


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.

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

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).

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.
Divers jeux : Puissance 4 - Chariot Wars - Sokoban
Ecrivez vos programmes basic sur PC avec BIDE
Lephenixnoir Hors ligne Administrateur Points: 24581 Défis: 170 Message

Citer : 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.
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
1, 2, 3, 4 ··· 10 ··· 20 ··· 30, 31, 32 Suivante

LienAjouter une imageAjouter une vidéoAjouter un lien vers un profilAjouter du codeCiterAjouter un spoiler(texte affichable/masquable par un clic)Ajouter une barre de progressionItaliqueGrasSoulignéAfficher du texte barréCentréJustifiéPlus petitPlus grandPlus de smileys !
Cliquez pour épingler Cliquez pour détacher Cliquez pour fermer
Alignement de l'image: Redimensionnement de l'image (en pixel):
Afficher la liste des membres
:bow: :cool: :good: :love: ^^
:omg: :fusil: :aie: :argh: :mdr:
:boulet2: :thx: :champ: :whistle: :bounce:
valider
 :)  ;)  :D  :p
 :lol:  8)  :(  :@
 0_0  :oops:  :grr:  :E
 :O  :sry:  :mmm:  :waza:
 :'(  :here:  ^^  >:)

Σ π θ ± α β γ δ Δ σ λ
Veuillez donner la réponse en chiffre
Vous devez activer le Javascript dans votre navigateur pour pouvoir valider ce formulaire.

Si vous n'avez pas volontairement désactivé cette fonctionnalité de votre navigateur, il s'agit probablement d'un bug : contactez l'équipe de Planète Casio.

Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2024 | Il y a 124 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements

Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd