|
Forum Index : Microcontroller and PC projects : Questions about MMBasic.c
| Author | Message | ||||
| gevik Newbie Joined: 04/07/2020 Location: NetherlandsPosts: 10 |
Hi, I was reading through the MMBasic.c file and would like to know a little bit about the history of how the parser/interpreter came to be. I read "The Maximite Story" and I understand that it was written from ground up inspired from bwBasic. I would like to know if there was/is a particular reason why a parser generator like yacc/lexx or some modern ones line ANTLR is/was not used. Thank you. |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
Well firstly yacc and lex (only one x) are used to create compilers and this is an interpreter. I'm not sure about ANTLR but MMBasic was designed to run on microcontrollers with limited memory and I did not want to load it up with needless layers of code. Essentially a complex layer of tools was not required. BASIC is quite simple, there is a command with a number of arguments. Each command does its own thing, no complex pasing required. Essentially the development started by constructing a simple mechanism for recognising commands and running the associated code. From then on I just added command after command until it was finished. Decoding expressions is something else. In MMBasic this is a recursive algorithm which was not based on any academic principals but was developed by me over a number of long days. This was the most complex and difficult part and amazingly, even though it was written many years ago, has had no bugs nor need for improvement. Geoff Geoff Graham - http://geoffg.net |
||||
| JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4142 |
Just a note: yacc/lex are fine for interpreters. (And they'll do recursive expressions etc, of course.) However, as MMBasic has mutated (especially on CMM2) I wouldn't fancy writing a grammar for it now! John Edited 2020-09-21 23:48 by JohnS |
||||
| Pilot352 Newbie Joined: 12/08/2020 Location: United StatesPosts: 34 |
It's finished? |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |