#1✎ 25ErtasIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthVideo GamesI like to play video games!HobbiesZelda Is Awesome!I love The Legend Of Zelda!Express Yourselfsorry 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/
Posted
Edited
by Ertas
#2✎ 341spaceturtlesVideo GamesI like to play video games!HobbiesAvatar BlockI didn't change my avatar for 30 days.WebsiteIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthHow far have you gotten?
Posted
#3✎ 393CyberYoshi64Expert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthGreat PageHiddenAchievementsNight PersonI like the quiet night and sleep late.Express Yourself
#4✎ 25ErtasIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthVideo GamesI like to play video games!HobbiesZelda Is Awesome!I love The Legend Of Zelda!Express Yourself
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
Posted
#5✎ 94SimeonScholarReceived for knowing a great deal about programming topicsAchievementsAmazing PageHiddenAchievementsDrawingI like to draw!HobbiesI 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 meI 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
Posted
Edited
by Simeon
#6✎ 188412Me21Syntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express YourselfThat won't work
Posted
#7✎ 25ErtasIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthVideo GamesI like to play video games!HobbiesZelda Is Awesome!I love The Legend Of Zelda!Express Yourself
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 meI 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
Posted
#9✎ 25ErtasIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthVideo GamesI like to play video games!HobbiesZelda Is Awesome!I love The Legend Of Zelda!Express Yourself
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
Posted
#10✎ 212seggiepantsCompilers 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.
Posted