Saturday, October 06, 2012 11:58 AMAnswerer
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
- 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.
- Edited by Nonki TakahashiEditor Saturday, October 06, 2012 11:59 AM
- Edited by Nonki TakahashiEditor Saturday, October 06, 2012 11:30 PM
- Edited by Nonki TakahashiEditor Sunday, October 07, 2012 12:03 AM
- Edited by Nonki TakahashiEditor Friday, October 26, 2012 11:50 AM update list
- Edited by Nonki TakahashiEditor Friday, October 26, 2012 11:51 AM update list
- Edited by Nonki TakahashiEditor Friday, October 26, 2012 11:52 AM
- Edited by Nonki TakahashiEditor Sunday, October 28, 2012 12:09 PM
- Edited by Nonki TakahashiEditor Saturday, December 29, 2012 9:46 AM (SKC235-1)
Saturday, October 06, 2012 4:57 PMAnswererIn 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.
Saturday, October 06, 2012 11:47 PMAnswerer
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
Saturday, October 06, 2012 11:50 PMOh, 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."
Friday, October 26, 2012 11:36 AMAnswerer
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 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.
Sunday, October 28, 2012 11:13 AMAnswerer
Today I published another parser generator, Parser Generator 1.3 (ZBG977-3) which generates a code block generator (SKC235-1).
- It tooks few minutes for large program both after [OK] and after Ctrl+A.
- Edited by Nonki TakahashiEditor Sunday, October 28, 2012 12:06 PM minor change
Sunday, October 28, 2012 9:49 PM
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.
Monday, October 29, 2012 2:09 AMAnswererNik, Thank you.
Monday, October 29, 2012 5:40 AMOK, 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 8:53 AMAnswerer
Do you mean to select other programming languages?