![]() |
SmallBasic Open Edition - Printable Version +- Small Basic Forum (https://litdev.uk/mybb) +-- Forum: Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=1) +--- Forum: C# Moving from Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=6) +--- Thread: SmallBasic Open Edition (/showthread.php?tid=147) |
RE: SmallBasic Open Edition - KristianVirtanen - 10-15-2024 Hello everyone. I know I shouldn't remember these anymore, but back in the day when I got excited about programming, the options for home computers were GWBasic, BASICA or MSX-Basic. Pascal and C and a few others had of course already appeared, but 95% of the home programmers of that time used Basic. For example, in GWBasic, the type of variables was indicated right at the end of the name. Code: $: String variable Regarding naming, there were otherwise very much the same rules as now in SmallBasic. And the Basics of that time didn't require variables to be initialized separately anyway, instead a variable could be activated by simply entering a value for it. And if I remember correctly, a variable that wasn't even created yet always gave a value anyway. String "" and numeric variables with a value of 0. As long as the size of the code remains in the tens or at most a couple of hundred lines, this is usually not a problem. But as the program grows, it very soon becomes a problem. I started to make the game described above, where the player was controlled in a changing environment while the computer-controlled guys moved there. In the game, you could shoot with a few different weapons, the field of view was limited by the walls etc. in the terrain. SmallBasic would have been able to function as an engine in that game, but the programmer, i.e. me, simply lost my nerve. Naming variables and tables took more time and effort (read pain) than figuring out the calculation needs of the game engine itself. The fact that all variables were always globally visible made it worse. Programming is the same, whether you use Basic, C or even JavaScript. It is "talking" to the computer in a specific language. And the majority of languages work very much the same way. In my opinion, perhaps too much is being thought about today, which is the best language for a beginner. I think the whole question is completely wrong. One should ask "how do we teach logical and mathematical thinking to a person interested in programming?" I personally like the way variables are used in JavaScript. They must be initialized separately and followed by the suffix "$", but the type of the variables is free. That is, the same variable can be either a string, double, integer or even an object. Probably some sort of hybrid model would be best, at least initially. Option SB at the beginning of the code would try to emulate SmallBasic as best as possible. A bit like, for example, FreeBasic can be used in different "modes" by entering parameters to the compiler. Even if "-lang qb". Code: #option SB Output: 2 Without the option, things wouldn't work the same way. Code: a = 1 Output: 1 MySub does not have visibility into the variable 'a' named in the main program, so it creates a new variable for itself with an initial value of 0. When returning from the subprogram, the original variable a is used. But I still have some work to do to get the error checking done, bug fixes and variable typings right with the library, so these thoughta can be left to simmer in the background for now. However, it's nice to note that there are still enough enthusiastic people around SmallBasic. RE: SmallBasic Open Edition - KristianVirtanen - 10-18-2024 Hi again. The library itself is practically ready. I got it done in the evenings and the documentation also written, so I think this progressed even better than expected. In practice, two more things need to be done.
And hey litdev, if you want to keep your forum just for the original SmallBasic, just let me know. I don't want to force myself here with my own project. RE: SmallBasic Open Edition - litdev - 10-18-2024 (10-18-2024, 08:41 AM)KristianVirtanen Wrote: And hey litdev, if you want to keep your forum just for the original SmallBasic, just let me know. I don't want to force myself here with my own project. No, go for it here - there is definitely interest and keen to see how it progresses. I always felt that Small Basic was a great introduction to programming, but should encourage folk to take the next steps - the next logical being C# probably. RE: SmallBasic Open Edition - jrmrhrb00 - 10-18-2024 Kristian, Not that I am a pessimistic person, but why do all of this when we already have SB-Prime? In SB-Prime you can already do a decompile to c# which is, as I understand, will get you to where SmallBasic Open Edition will get you to. With a decompiled program which is in c# you can already see and learn how to program in c#. I don't want to discourage you, but truthfully, I don't see the point. JR RE: SmallBasic Open Edition - KristianVirtanen - 10-18-2024 Hi JR, Like probably everyone else here on the forum, I truly appreciate the work that has been put into SB-Prime. I remember when I explored it first time out of curiosity, it was easy to see the level of effort and enthusiasm involved. SB-Prime is undoubtedly a valuable tool for anyone working with the original SmallBasic. That being said, SmallBasic Open Edition has a different focus and goal. The purpose of my project is to create a standalone, open-source converter that translates SmallBasic code directly to modern C# using .NET 8.0. This approach offers a few distinct advantages:
While both projects use C#, they serve different purposes and cater to different needs within the community. Personally, I think SmallBasic is in a situation somewhat like QBasic was about 20 years ago with its DOS dependency. It’s time for an upgrade to more modern frameworks. Regardless of whether my translator becomes widely used, I believe any work that helps keep this nice and comfortable language alive is a positive contribution. - Kristian RE: SmallBasic Open Edition - z-s - 10-19-2024 .net 8 don't work in my windows 8.1 the most worst thing of ms to remove older version when new come our sb libs targeting.net 4.5 may not work RE: SmallBasic Open Edition - litdev - 10-19-2024 I guess the idea is that it is a conversion from SB to C# that reproduces the standard library functionality using natural C# code and types (not Primitive types and more conventional array/lists for example). Comments:
RE: SmallBasic Open Edition - KristianVirtanen - 10-19-2024 Hello. Now I want to clarify that this is not a re-creation of the SmallBasic environment as it is now, but a compiler with a library that converts SmallBasic code to C# and compiles it. SBOE.dll supports and uses all appropriate data types, string, int, boolean and so on. If the SmallBasic code to be compiled does not have a separately defined variable type, the compiler marks it as a dynamic variable. [sb-code] 'This is ok. a = 1 a = 2.3 a = "text" [/sb-code] [C# code] dynamic a; a = 1; a = 2.3; a = "text"; [/c#-code] [sb-code] ' But you can also do this. int a a = 1 a = "This causes error" [/sb-code] [C# code] int a; a = 1; a = "This causes error"; // As expected, this causes error. [/C#-code] I fully understand that those who have used SmallBasic for years would want an exact replica of the language itself, the editor, extensions and so on, but that is not the goal. Some things are left out completely, some things change and some things come as new additions. RE: SmallBasic Open Edition - z-s - 10-19-2024 Ok got it I am currently making a simple traspilier for js that will traspile a basic like but powerful language which I call skull script. I will also write if I got time in it smallbasic.js for converting sb to online js html code. The most of the work of it is over just finishing left. I could give a example : PHP Code: let x = "hello world from skull script!!" Well see how it goes if we got some community we could extend it more. Currently I made its transpilier in csharp but I will make one more copy of it in cpp or c for cross platform support and if got time a js version. RE: SmallBasic Open Edition - KristianVirtanen - 10-20-2024 Hi z-s. JS was my first language of thoughts when i planned to make some kind of translator/converter. but i ended up to C#. I hope you succeed with your project. |