LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

I'm creating a online SmileBasic interpeter

Root / General / [.]

ErtasCreated:
sorry if this topic doesnt fit here but what im doing is create a SmileBasic interpeter, its like with the touchscreen command shortcuts and the direct mode and edit mode are supported (including slot 1 2 3) i dont know how long its gonna take but if you want to help create the interpeter, DM me to collaborate PS: the website is https://smilebasic.glitch.me/

How far have you gotten?

How far have you gotten?
..., grab some coffee and relax.

How far have you gotten?
How far have you gotten?
..., grab some coffee and relax.
1st, i currently only have print, acls and option. 2nd, i put grab some coffee and relax because i was bored

I would be happy to help Instead of making it an interpreter, since you chose JavaScript, you can make it a compiler since it supports reflection (the exec() function). This would make it run soo much faster. Faster than the original SmileBASIC. I don't know your JavaScript programming experience, but the easiest way to make a 'compiler' would be to have a Regular Expression with capturing groups to replace each line with its appropriate JavaScript syntax. An example FOR loop conversion to JavaScript: code.replace( /FOR +([a-z]+) *= *([a-z0-9]+) +TO +([a-z0-9]+)( +STEP +([a-z0-9]+))? +/gi, "for(var $1=$2;$1<$3;$1+=1||$5) {" ) The issue you will run into is the fact that JavaScript forces a structured WAIT/VSYNC, using SetTimeout(). SmileBASIC does not do this. There are workarounds in JavaScript called promises, which allow unstructured non-async sleep. It gets a bit advanced. When you have a fully converted program its easy since all you need to do is type exec(code) in JavaScript. Well, I'm here to help if you need me
shameless plugI did a similar project in the past http://s1meon.art/project/BASIC-Programming.html This converts a different flavor of BASIC into JavaScript. It may be useful to you

That won't work

I would be happy to help Instead of making it an interpreter, since you chose JavaScript, you can make it a compiler since it supports reflection (the exec() function). This would make it run soo much faster. Faster than the original SmileBASIC. I don't know your JavaScript programming experience, but the easiest way to make a 'compiler' would be to have a Regular Expression with capturing groups to replace each line with its appropriate JavaScript syntax. An example FOR loop conversion to JavaScript: code.replace( /FOR +([a-z]+) *= *([a-z0-9]+) +TO +([a-z0-9]+)( +STEP +([a-z0-9]+))? +/gi, "for(var $1=$2;$1<$3;$1+=1||$5) {" ) The issue you will run into is the fact that JavaScript forces a structured WAIT/VSYNC, using SetTimeout(). SmileBASIC does not do this. There are workarounds in JavaScript called promises, which allow unstructured non-async sleep. It gets a bit advanced. When you have a fully converted program its easy since all you need to do is type exec(code) in JavaScript. Well, I'm here to help if you need me
shameless plugI did a similar project in the past http://s1meon.art/project/BASIC-Programming.html This converts a different flavor of BASIC into JavaScript. It may be useful to you
oh thanks for trying to help me! but check your DM's ill give a link to the project

You may want to team up with 12ME21's 12-BASIC http://smilebasicsource.com/forum?fpid=21721. Last I looked I was rather impressed. I will reiterate my suggestions here. Compiler/Interpreter development is non-trivial, and requires careful planning. It is not something you start because you are bored or for the lulz. You would be better off learning a new language such as Javascript or adopting an existing Basic compiler like say QB64 http://www.qb64.net a QBasic/QuickBasic work alike. If you want to make one still I suggest research. The Dragon book is very much a University level book, and is somewhat outdated it seems. https://www.amazon.com/Compilers-Principles-Techniques-Tools-2nd/dp/0321486811# I have seen recommendations online for: Modern Compiler Implementation in Java https://www.amazon.com/Modern-Compiler-Implementation-Andrew-Appel/dp/052182060X/ref=mp_s_a_1_1?ie=UTF8&qid=1530553448&sr=8-1&pi=AC_SX236_SY340_QL65&keywords=modern+compiler+implementation+in+java+second+edition&dpPl=1&dpID=41RIxhpvQ9L&ref=plSrch and Engineering: a Compiler https://www.amazon.com/gp/aw/d/012088478X/ref=pd_aw_fbt_14_img_3?ie=UTF8&psc=1&refRID=HF7YZYX9AM8SW2GBFJFR I also highly recommend using some compiler making tools like LLVM, ANTLR, YACC/Bison, LEX/FLEX. I expect some BNF from a compiler/interpreter project. Do you have any? I don't think ad hoc efforts will scale. Something like this needs engineering. Maybe try something like a math expression evaluator instead of a full programming language for your first interpreter. The following link has some BNF examples. https://rosettacode.org/wiki/BNF_Grammar

You may want to team up with 12ME21's 12-BASIC http://smilebasicsource.com/forum?fpid=21721. Last I looked I was rather impressed. I will reiterate my suggestions here. Compiler/Interpreter development is non-trivial, and requires careful planning. It is not something you start because you are bored or for the lulz. You would be better off learning a new language such as Javascript or adopting an existing Basic compiler like say QB64 http://www.qb64.net a QBasic/QuickBasic work alike. If you want to make one still I suggest research. The Dragon book is very much a University level book, and is somewhat outdated it seems. https://www.amazon.com/Compilers-Principles-Techniques-Tools-2nd/dp/0321486811# I have seen recommendations online for: Modern Compiler Implementation in Java https://www.amazon.com/Modern-Compiler-Implementation-Andrew-Appel/dp/052182060X/ref=mp_s_a_1_1?ie=UTF8&qid=1530553448&sr=8-1&pi=AC_SX236_SY340_QL65&keywords=modern+compiler+implementation+in+java+second+edition&dpPl=1&dpID=41RIxhpvQ9L&ref=plSrch and Engineering: a Compiler https://www.amazon.com/gp/aw/d/012088478X/ref=pd_aw_fbt_14_img_3?ie=UTF8&psc=1&refRID=HF7YZYX9AM8SW2GBFJFR I also highly recommend using some compiler making tools like LLVM, ANTLR, YACC/Bison, LEX/FLEX. I expect some BNF from a compiler/interpreter project. Do you have any? I don't think ad hoc efforts will scale. Something like this needs engineering. Maybe try something like a math expression evaluator instead of a full programming language for your first interpreter. The following link has some BNF examples. https://rosettacode.org/wiki/BNF_Grammar
i dont plan on making a compiler yet but its informative i guess also important: theres only 2 days until summer vacation, i dont have time until school ends, so i cant work now but later i can

Compilers and interpreters aren't all that different. One writes out code from an abstract syntax tree, the other translates it into actions. Considering Java, .Net, and Python all build something to an intermediate code step things get fuzzier still. Anyway have a fun summer vacation, and good luck on the project.