locked
Small Basic Parser Generator RRS feed

  • General discussion

  • I wrote a parser generator written in Small Basic.  I'm going to introduce parser generator series in this thread.

    Program list of this thread:

    • Parser Generator 0.4 (XWX066) generates Graphics Interpreter (XRZ138)
    • Parser Gererator 1.3 (ZBG977-3) generates Code Block Generator (SKC235-1)

    The first article:

    Parser is a program which analyses program language syntax and does something.  That will be a compiler, an interpreter, a program formatter, a program converter, or etc.

    The first one is a parser generator which generates a Small Basic Graphics Interpreter.  The program ID is XWX066. (Small Basic Parser Generator 0.4)

    Please save this program as "ParserGenerator04.smallbasic".

    Lines 23 and 918 are commented out automatically by Small Basic server, so comment in these lines before running.


    Nonki Takahashi






    • Edited by Nonki Takahashi Thursday, December 25, 2014 9:35 AM added program ID for Graphics Interpreter
    Saturday, October 6, 2012 11:58 AM

All replies

  • In program XWX066, I added code what to do into it.  So, this program became an interpreter generator.  I'm planning to separate parser generator and what to do.  After that the parser generator will read code what to do from the other source program.

    Nonki Takahashi

    Saturday, October 6, 2012 4:57 PM
  • Inside of Parser Generator 0.4 (XWX066)

    This program generates a interpreter named "SBGInterpreter04.smallbasic".

    • Subroutines start with Exec_, Lex_ and SBGI_ will be copied to the interpreter.
    • Subroutines start with PG_ are parser generator itself.  PG_Init is a core subroutine and contains syntax of Small Basic graphics as BNF format (but not strict BNF here).
    • Subroutine SB_GetSub gets subroutine source code from given file name.

    Language syntax is defined as BNF.  So, many languages can be parsed by changing BNF, such as Small Basic (of course), old type of BASIC, any markup languages or BNF itself etc.

    * BNF : Backus-Naur Form 


    Nonki Takahashi

    Saturday, October 6, 2012 11:47 PM
  • Oh, thanks for the explanation. I didn't know what a parser generator was.

    I am a 10 year old that loves math, games, and computers. "Everyone is potentially great, you just have to turn it into kinetic greatness."

    Saturday, October 6, 2012 11:50 PM
  • Today I published another parser generator, Parser Generator 1.1b (ZBG977) which generates a code block generator (SKC235).

    Generated code block generator is a tool to generate HTML Small Basic code block especially for TechNet Wiki article for Small Basic.

    This tool is still beta version.

    Preview screen

    Generated code

    Known issue:

    • Preview frame or code sometimes remain on screen when width or height changed.
    • It tooks few minutes for large program.
    • Null line will be overrode by next line in web browser.

    Nonki Takahashi

    Friday, October 26, 2012 11:36 AM
  • Today I published another parser generator, Parser Generator 1.3 (ZBG977-3) which generates a code block generator (SKC235-1).

    Known issue:

    • It tooks few minutes for large program both after [OK] and after Ctrl+A.


    Nonki Takahashi


    Sunday, October 28, 2012 11:13 AM
  • Wow - this is extremely impressive.

    I've done some work with language implementation myself but using parsing expression grammars etc. - rolling it all yourself, and in Small Basic, is quite the achievement.

    Sunday, October 28, 2012 9:49 PM
  • Nik, Thank you.

    Nonki Takahashi

    Monday, October 29, 2012 2:09 AM
  • OK, forgive me if this is covered in another thread, I haven't had time to look through them, but it's just occurred to me that you could use this to extend the language while still generating code that will run in the existing IDE/Silverlight plugin - if so, very, very cool!
    Monday, October 29, 2012 5:40 AM
  • Do you mean to select other programming languages?

    If so, I don't have any plan about that at this point.  TechNet Wiki has it's tool to add code block and that tool has ability to select Markup - (x)HTML, XML, ASPX,... -, Javascript, C#, CPP, VB, Php, SQL, Delphi, and Python.


    Nonki Takahashi

    Monday, October 29, 2012 8:53 AM
  • I have an idea to create new tool with this parser generator code.

    The tool name is SBDoc which generates a document for a Small Basic program.

    Are you interested in this idea?


    Nonki Takahashi

    Saturday, June 15, 2013 12:16 PM
  • Nonki I think the doc idea could be very useful even if it's just viewed on the screen (for those who don't use printers). A print out is really useful.

    Atm I need a formatter for my web stuff and msdn posts.

    I'm building my own and it looks similar to your approach. <div><code> copy and paste.

    I use VS for webs and to avoid any ide problems I wont be using any spaces. 32 will= &ensp;

    Also i'll be testing for combos of 13 and 10 and using <br />.

    Friday, December 12, 2014 3:33 AM
  • Jibba Jabba, thank you for your comment.  I'd like to define comment format for Small Basic document.

    And good try to build your own code formatter.  I read your thread also.


    Nonki Takahashi

    Wednesday, December 24, 2014 7:59 AM