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

C# in SmileBASIC

Root / Talk About Programs / [.]

RNGesusCreated:
This is just an idea, bit what if you combine c# and SmileBASIC? I know that you can add commands and have the command adding program loaded in slot 1, 2 or 3. Is this possible? And if it is, why not combine multiple languages such as Java with C++?

you'd probably need to JIT compile the C# code into SB code at runtime which uh...good luck

That's... probably too much to hope for :)

Yes, someone's totally going to do JIT on SB. If someone does that, well, idk

Its not necessary to do JIT. The real problem is that the syntax of C# is much more complex than SB. In order to know what the code means, the compiler has to be able to break the source code down into "tokens". In BASIC the parsing doesn't really know what state its in, thats why we have to do things like IF ... THEN... ENDIF. To parse a more advanced syntax, you have to implement a parsing state machine that can build an abstract syntax tree and traverse it. Which is very difficult in basic. I've taken a swing at writing an object-oriented language with Lowerdash. Its rough around the edges, but has the same core feature set as JavaScript, with a more BASIC syntax

You'd be back to PTC levels of performance. All that work to make smilebasic a much worse interpreter. Nobody with the brains to accomplish this will even try it.

@DrZog If you can compile the code (AST + visitors, eugh), you can end up with pretty straightforward basic. At its worst, it would probably be about a 25% speed loss*. * depends on the level of context switching