? Nossrec, The Precompiler Made To Replace SmileBasic (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password

🔒 Nossrec, The Precompiler Made To Replace SmileBasic

1 2 3
  • #1 ✎ 477 SquareFingers
    Nossrec is a JIT precompiler I am making in SmileBasic that is intended to completely replace the use of SB! Nossrec takes code made in the normal SB editor, reads it, outputs legal SB code, and runs the SB code.
    What you describe is not 'JIT'.
    Posted
  • #2 ✎ 270 NeatNit First Week Joined in the very first week of SmileBASIC Source Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Night Person I like the quiet night and sleep late. Express Yourself If you have all this working, I'm just going to have to bow down and pledge allegiance to you right now! That is some impressive stuff. I do wonder if this will get a lot of use though. It may be more powerful, but it's a lot less noob-friendly than SmileBASIC is. Posted
  • #3 ✎ 11 MyLegGuy Why not get rid of def when declaring a method? "def public void main" to just "public void main" Posted
  • #4 ✎ 68 calc84maniac OSP Contest 1 Winner I won the first SmileBASIC Source OSP Contest! Programming Contest Amazing Page Hidden Achievements Scholar Received for knowing a great deal about programming topics Achievements
    Nossrec is a JIT precompiler I am making in SmileBasic that is intended to completely replace the use of SB! Nossrec takes code made in the normal SB editor, reads it, outputs legal SB code, and runs the SB code.
    What you describe is not 'JIT'.
    Yeah, after looking at the relevant Wikipedia pages I would say it's Ahead-Of-Time compilation, even if the compilation is being done at runtime, because the compilation is completely done before running any compiled code.
    Posted
  • #5 ✎ 180 phil_ Scholar Received for knowing a great deal about programming topics Achievements osu! Is Awesome! I love osu! Express Yourself First Day Joined on the very first day of SmileBASIC Source Website
    Nossrec is a JIT precompiler I am making in SmileBasic that is intended to completely replace the use of SB! Nossrec takes code made in the normal SB editor, reads it, outputs legal SB code, and runs the SB code.
    What you describe is not 'JIT'.
    Yeah, after looking at the relevant Wikipedia pages I would say it's Ahead-Of-Time compilation, even if the compilation is being done at runtime, because the compilation is completely done before running any compiled code.
    Fixed. Anyway, static classes are partially implemented! There are still a lot of "make the code look nice" things I've yet to add. After that, I will release the first beta version. After that, I will implement normal classes.
    Posted
  • #6 ✎ 180 phil_ Scholar Received for knowing a great deal about programming topics Achievements osu! Is Awesome! I love osu! Express Yourself First Day Joined on the very first day of SmileBASIC Source Website
    If you have all this working, I'm just going to have to bow down and pledge allegiance to you right now! That is some impressive stuff. I do wonder if this will get a lot of use though. It may be more powerful, but it's a lot less noob-friendly than SmileBASIC is.
    Thank you for the support. All of what I showed you is indeed working ;) Anyway, I do not expect the entire community to switch over to Nossrec. This should be ideally used by the experienced programmer who's having lots of problems with SB's limitations (or just someone who comes from an OOP background).
    Posted
  • #7 ✎ 180 phil_ Scholar Received for knowing a great deal about programming topics Achievements osu! Is Awesome! I love osu! Express Yourself First Day Joined on the very first day of SmileBASIC Source Website
    Why not get rid of def when declaring a method? "def public void main" to just "public void main"
    I considered this, but "def" is used by the compiler to identify the start of a function block. I could remove it, but that would require lots of changes, surprisingly.
    Posted
  • #8 ✎ 68 calc84maniac OSP Contest 1 Winner I won the first SmileBASIC Source OSP Contest! Programming Contest Amazing Page Hidden Achievements Scholar Received for knowing a great deal about programming topics Achievements
    Let me show you one more program that will show you a couple more features I have working right now. 'outputs 0 through 4 on the screen by storing values from a "for" loop in an object, and reading them back out. def public void main new object[] obj_array <- [5] for (int i=0;i<5;i++) object_array[i]=obj(i) end for (i=0;i<5;i++) writeline str(obj_array[i]) end endIn this example, you can see how "object" is now a data type (used like an array) and how I completely changed "for" loops to act like C-style "for."
    Is "object" a built-in type, or something defined in the program? Also, I think there may be some typos there, you're kind of alternating between "object" and "obj". Or is obj() the way to generate an object?
    Posted
  • #9 ✎ 180 phil_ Scholar Received for knowing a great deal about programming topics Achievements osu! Is Awesome! I love osu! Express Yourself First Day Joined on the very first day of SmileBASIC Source Website
    Let me show you one more program that will show you a couple more features I have working right now. 'outputs 0 through 4 on the screen by storing values from a "for" loop in an object, and reading them back out. def public void main new object[] obj_array <- [5] for (int i=0;i<5;i++) object_array[i]=obj(i) end for (i=0;i<5;i++) writeline str(obj_array[i]) end endIn this example, you can see how "object" is now a data type (used like an array) and how I completely changed "for" loops to act like C-style "for."
    Is "object" a built-in type, or something defined in the program? Also, I think there may be some typos there, you're kind of alternating between "object" and "obj". Or is obj() the way to generate an object?
    Object is a built-in type to Nossrec. Obj() is how to convert to an object. I didn't want to have to do something like that, but it was inevitable. So now theres str(), val(), and obj().
    Posted
  • #10 ✎ 1055 randomous Owner Robot Hidden Easter Eggs Second Year My account is over 2 years old Website Drawing I like to draw! Hobbies A "for" loop in C is essentially a fancy "while" loop. For instance, in C (and any other language with this syntax), you can do silly stuff like: for(printf("loop start\n"); shouldrun(); printf("loop iteration\n")) { //Something silly here } This is because all 3 "for" loop sections are just expressions. The first expression is what is run at the beginning (and doesn't even have to be an assignment), the second is the loop check expression and allows the loop to continue if the expression is true, and the third is what you do at the end of every loop iteration. Will your language support this? If not, you'll need to specify very clearly that it doesn't, as this is the expected behavior. Posted Edited by randomous
  • #11 ✎ 68 calc84maniac OSP Contest 1 Winner I won the first SmileBASIC Source OSP Contest! Programming Contest Amazing Page Hidden Achievements Scholar Received for knowing a great deal about programming topics Achievements Oh, and if you are indeed implementing your for loops using SmileBASIC's WHILE, keep in mind that every continue will need to execute the increment statement before continuing the loop. Posted
  • #12 ✎ 124 kldck_hul First Month Joined in the very first month of SmileBASIC Source Website Scholar Received for knowing a great deal about programming topics Achievements Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself This looks like quite the undertaking if you start adding features. And I wish you the best of luck. But still, very cool.
    I do wonder if this will get a lot of use though. It may be more powerful, but it's a lot less noob-friendly than SmileBASIC is.
    I'm wondering if this is usable at all from a 3DS. So far, the examples seem to be longer ways to achieve shorter SmileBasic code. Are there any plans to make this compilable from a PC? I can see a type system being useful when you can actually type a lot of types.
    new object objectname <- classname
    What is the arrow doing in this syntax? Are types and classes separate? Why are there two ways to declare an object variable?
    new object[] obj_array <- [5]
    Is this an array literal?
    switch (op) case "+" ans=num1+num2 end ...
    I'm curious how this is implemented in SB. This also has a very specific behavior in C. Is the "end" required after every case? EDIT:
    C#, F#, and Python
    Which OOP flavour is this going to be? Those are pretty much the most polar languages in terms of the object model.
    Posted Edited by kldck_hul
  • #13 ✎ 180 phil_ Scholar Received for knowing a great deal about programming topics Achievements osu! Is Awesome! I love osu! Express Yourself First Day Joined on the very first day of SmileBASIC Source Website
    A "for" loop in C is essentially a fancy "while" loop. For instance, in C (and any other language with this syntax), you can do silly stuff like: for(printf("loop start\n"); shouldrun(); printf("loop iteration\n")) { //Something silly here } This is because all 3 "for" loop sections are just expressions. The first expression is what is run at the beginning (and doesn't even have to be an assignment), the second is the loop check expression and allows the loop to continue if the expression is true, and the third is what you do at the end of every loop iteration. Will your language support this? If not, you'll need to specify very clearly that it doesn't, as this is the expected behavior.
    For loops compile to WHILE loops, so for (int i=0; i<5; i++) 'code goes here endcompiles to VAR i%=0 WHILE i%<5 'code goes here INC i% WEND
    Posted Edited by phil_
  • #14 ✎ 270 NeatNit First Week Joined in the very first week of SmileBASIC Source Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Night Person I like the quiet night and sleep late. Express Yourself
    For loops compile to WHILE loops, so for (int i=0; i<5; i++) 'code goes here endcompiles to VAR i%=0 WHILE i%<5 'code goes here INC i% WEND
    What about continues then? as calc said:
    Oh, and if you are indeed implementing your for loops using SmileBASIC's WHILE, keep in mind that every continue will need to execute the increment statement before continuing the loop.
    Posted
  • #15 ✎ 180 phil_ Scholar Received for knowing a great deal about programming topics Achievements osu! Is Awesome! I love osu! Express Yourself First Day Joined on the very first day of SmileBASIC Source Website Continue has not been implemented and I have no plans to do so. If there is strong enough demand,I suppose I could add it. Posted
  • #16 ✎ 207 Guzzler First Week Joined in the very first week of SmileBASIC Source Website Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength So what's the point of having this? Posted
  • #17 ✎ 180 phil_ Scholar Received for knowing a great deal about programming topics Achievements osu! Is Awesome! I love osu! Express Yourself First Day Joined on the very first day of SmileBASIC Source Website
    Are there any plans to make this compilable from a PC? I can see a type system being useful when you can actually type a lot of types.
    I considered making this compilable to C#. I am still pondering doing this, but the main purpose of Nossrec was to be an optional complete replacement of SmileBasic
    new object objectname <- classname
    What is the arrow doing in this syntax? Are types and classes separate? Why are there two ways to declare an object variable?
    <- corresponds with the "new" keyword. "New" is used for two main purposes: creating arrays, and assigning class references to objects. You can create an object variable type that does not correspond with a class (basically a variable that can hold any value) by not using the "new" keyword and using "=" instead of "<-"
    new object[] obj_array <- [5]
    Is this an array literal?
    This is just how you declare an array. Like I said, "new" and "<-" are also used for arrays, not just assigning a class reference to an object. This might be changed later depending on your feedback.
    switch (op) case "+" ans=num1+num2 end ...
    I'm curious how this is implemented in SB. This also has a very specific behavior in C. Is the "end" required after every case?
    This compiles to legal code for my "switch/case" library, which has a few COMMON DEFs that deal with this. The "end" is required after every case, just as "break" would be required in C#. I replaced it with "end" because "end" is pretty much the universal keyword for something completing, like for/while/dowhile loops, ifs, switch/case, etc.
    C#, F#, and Python
    Which OOP flavour is this going to be? Those are pretty much the most polar languages in terms of the object model.
    Objects will have the functionality of C#, with syntax similar to what you might see in F# or Python.
    Posted Edited by phil_
  • #18 ✎ 180 phil_ Scholar Received for knowing a great deal about programming topics Achievements osu! Is Awesome! I love osu! Express Yourself First Day Joined on the very first day of SmileBASIC Source Website
    So what's the point of having this?
    As was in the original post:
    Its main goal was to do better what SB does, and add things that were not possible in SB. Nossrec completely revamps normal SB code and makes it look cleaner. It also removes requirements like variable suffixes; the compiler takes care of that automatically.
    Posted
  • #19 ✎ 207 Guzzler First Week Joined in the very first week of SmileBASIC Source Website Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength
    So what's the point of having this?
    As was in the original post:
    Its main goal was to do better what SB does, and add things that were not possible in SB. Nossrec completely revamps normal SB code and makes it look cleaner. It also removes requirements like variable suffixes; the compiler takes care of that automatically.
    k
    Posted
  • #20 ✎ 180 phil_ Scholar Received for knowing a great deal about programming topics Achievements osu! Is Awesome! I love osu! Express Yourself First Day Joined on the very first day of SmileBASIC Source Website http://smilebasicsource.com/page?pid=146 Nossrec Beta v1 is out! The programs shown on this page need to be put inside a static class named "entry" (example on the program page). Posted
1 2 3