PropBasic 3 Development log
Bean
Posts: 8,129
Hi all PropBasic fans.
I thought I would start a post about the development of PropBasic 3 to let everyone in on the progress, and to get feedback about features and such.
Right now I am working on the expression evaluator. This is critical to get right since every parameter of every command will be run through it.
The EE also needs to keep track of what operators are used in the whole program so the code for them can be included (and unused operators excluded) to save code space.
The EE needs to do two jobs, it needs to actually evaluate the expression at compile-time so the compiler knows if the expression is a constant or not.
If it is a constant, then just the constant value is output as code.
If the expression is NOT a constant then the evaluator needs to generate all the code needed to calculate the expression on the propeller at run-time.
The EE also needs to do string handling. So an operator could take a string as an input and output a value (like the ASCII function).
Or an operator could take a value as an input and output a string (like the STR function).
Or an operator could take a string as input and output a string (Like LEFT$, MID$, RIGHT$).
Currently I have numeric expression working pretty well. I need to work on the string expressions next.
Here is a sample output:
Bean
I thought I would start a post about the development of PropBasic 3 to let everyone in on the progress, and to get feedback about features and such.
Right now I am working on the expression evaluator. This is critical to get right since every parameter of every command will be run through it.
The EE also needs to keep track of what operators are used in the whole program so the code for them can be included (and unused operators excluded) to save code space.
The EE needs to do two jobs, it needs to actually evaluate the expression at compile-time so the compiler knows if the expression is a constant or not.
If it is a constant, then just the constant value is output as code.
If the expression is NOT a constant then the evaluator needs to generate all the code needed to calculate the expression on the propeller at run-time.
The EE also needs to do string handling. So an operator could take a string as an input and output a value (like the ASCII function).
Or an operator could take a value as an input and output a string (like the STR function).
Or an operator could take a string as input and output a string (Like LEFT$, MID$, RIGHT$).
Currently I have numeric expression working pretty well. I need to work on the string expressions next.
Here is a sample output:
PropBasic3 June 4, 2013 Evaluate 5 * (123 + 456) call #PushValue long 5 call #PushValue long 123 call #PushValue long 456 call #ADD call #MULT The constant is 2895 Operators used: COMMA LPAREN RPAREN ADD MULT
Bean
Comments
I am new to using forums so I hope I don't do anything wrong.
I am trying to find latest info on PropBasic 3 and PropBasic Studio.
Thanks,
JonL
The compiler is a console app written in Delphi and can be compiled with Lazarus for other platforms.
I've been waiting for the Propeller 2 to get finalized before working on PropBasic 3 any further. I want to be able to write it to compile for both Propeller 1 and Propeller 2. And I'd rather do it at the same time.
Bean
eg I've been impressed with FreeBASIC, which seems good for quick/small projects, and has a useful debugger.
The Debug allows users to get their code functions functionally/logically checked before deploying in an embedded device.
Lazarus is reasonably popular ( tho I'd admit not as popular as C )
Jon you do realize that BST ( one of the most advanced compilation tools to date for the prop and still widely used) was written in Lazarus. Object pascal is no worse / better than C or C++, just another procedural language with a different syntax. GNU Object pascal/lazarus is highly productive and compiled to highly optimize machine code as one must attest to with the aformentioned creation from BradC. Thanks Brad for all you did.
Woops and forgot to mention that Lazarus is completely X-platform as well.