Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:43 14 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Questions about MMBasic.c

Author Message
gevik

Newbie

Joined: 04/07/2020
Location: Netherlands
Posts: 10
Posted: 08:51am 21 Sep 2020
Copy link to clipboard 
Print this post

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: Australia
Posts: 3308
Posted: 11:07am 21 Sep 2020
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 4142
Posted: 01:46pm 21 Sep 2020
Copy link to clipboard 
Print this post

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 States
Posts: 34
Posted: 03:59pm 22 Sep 2020
Copy link to clipboard 
Print this post

  Quote  ...From then on I just added command after command until it was finished.


It's finished?  
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025