locked
small basic compiler execution RRS feed

  • Question

  • Hi,

    I'm a student and I have a subject that requires me to write a report on programming language compilers. I was tasked to write on Small Basic. I am wondering if someone here knows how the Small Basic compiler interprets.

    Take the following statement: 

     

    TextWindow.WriteLine("Hello, World!")

     

    After the developer hits F5(run), what exactly happens? How does the compiler interpret this statement for the machine to understand, for multiple statements as well. Feedback would be greatly appreciated. If this is not the right forum to be posting this kind of question, please advice me.

    Thank you!




    • Edited by jdalino Friday, September 30, 2011 11:20 AM
    Friday, September 30, 2011 10:55 AM

Answers

  • I disagree, Oskariok, Small Basic behaves like any other DotNET Language.  The code is converted to CIL(Common Intermediate Language) then it is run through the CLR (Common Language Runtime) to produce native code a computer can run. 

    Small Basic does have the feature of creating a vb project from Small Basic source, but it is a seperate function from running a Small Basic program

    • Marked as answer by jdalino Sunday, October 2, 2011 12:18 PM
    Friday, September 30, 2011 8:15 PM

All replies

  • Compiler just converts your code to visual basic and inserts few lines.

    For example

    TextWindow.WriteLine("Hello World!")
    

    is

     

    Friend NotInheritable Class _SmallBasicProgram
    <br/>    PrivateScope Shared Sub _Main()
            SmallBasicApplication.BeginProgram()
            TextWindow.WriteLine("Hello World!")
            TextWindow.PauseIfVisible()
            SmallBasicApplication.EndProgram()
        End Sub
    
    End Class
    

    And then compiler uses vb compiler to convert vb code to executable.

     

     

     


    Sorry My Bad English
    Friday, September 30, 2011 12:36 PM
  • I disagree, Oskariok, Small Basic behaves like any other DotNET Language.  The code is converted to CIL(Common Intermediate Language) then it is run through the CLR (Common Language Runtime) to produce native code a computer can run. 

    Small Basic does have the feature of creating a vb project from Small Basic source, but it is a seperate function from running a Small Basic program

    • Marked as answer by jdalino Sunday, October 2, 2011 12:18 PM
    Friday, September 30, 2011 8:15 PM
  • Try looking at the Small Basic source.
    ~~AirWaves!!~~
    Saturday, October 1, 2011 11:46 PM
  • Guys, 

     

    Thank you for your responses.

     

    @AirWaves: I'm not sure if I understand you correctly, do you mean decompiling it? is it legal?

    @Rushworks: may I know the source/basis of your answer. 

    @Oskariok: same, may I know the source/basis of your answer. 

     

     

    Sunday, October 2, 2011 11:28 AM
  • from the first post of Small Basic blog: http://blogs.msdn.com/b/smallbasic/archive/2008/10/23/hello-world.aspx

    "Small Basic starts with a really simple programming language that gathers inspiration from the original BASIC language.  It has no more than 15 keywords and is strictly imperative.  There are no classes, scopes, generics, lambdas, etc. - just pure imperative code.  The language is typeless and all variables are dynamic and global all the time.  The code gets compiled to IL and runs on the .Net Framework.

    It comes with a set of libraries that can be accessed from within a Small Basic program.  Since the language itself is .Net based, new libraries can be created or the existing libraries modified using any .Net programming language. "

    It seems Rushworks is correct.

    Sunday, October 2, 2011 12:18 PM
  • Decompiling should be legal, as long as you are not trying to copy it. At least that is what I heard from some people... : )
    ~~AirWaves!!~~
    Sunday, October 2, 2011 6:13 PM
  • Is it legal Wikipedia

    My lay interpretation is that using something like ILSpy to view .Net assemblies for the purpose of self learning or using reflection to interact with the code is OK.  None but the very simplest extensions would be possible without this and SmallBasic was explicitly designed with extensions in mind.

    Copying any code and passing it off as your own or making money from it is where problems start, but in the world of free learning software like SmallBasic where there are limited commercial implications it is just bad form in my opinion.

    Sunday, October 2, 2011 7:31 PM