Forum
Extending the language - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Wishlist (https://www.boriel.com/forum/forumdisplay.php?fid=14)
+---- Thread: Extending the language (/showthread.php?tid=403)



Extending the language - britlion - 11-07-2011

How hard would it be to make the language modular enough that it could be extended with new keywords?

E.g. if I wanted 64 column printing to work with MICROPRINT AT 18,43;INVERSE 1; "TEXT"

I could publish a module that would add this functionality?


Re: Extending the language - nitrofurano - 11-08-2011

britlion Wrote:How hard would it be to make the language modular enough that it could be extended with new keywords?

E.g. if I wanted 64 column printing to work with MICROPRINT AT 18,43;INVERSE 1; "TEXT"

I could publish a module that would add this functionality?

imho, the problem of definition of 'micro' sounds too ambiguous and subjective - it can be anything


Re: Extending the language - britlion - 11-09-2011

nitrofurano Wrote:imho, the problem of definition of 'micro' sounds too ambiguous and subjective - it can be anything


....

I'm not sure what that has to do with the question?


Re: Extending the language - boriel - 11-09-2011

Hmmm. It seems my answer got lost... :?:

Currently it's almost impossible to extend the language that way, but it might be in the future. By enforcing FREEBASIC compatibility I lost VBScript compatibility (somewhat). In VB you can define subs and call them with IDENTIFIER PARAM1, PARAM2 ... (with no parenthesis).

This way you can declare a subrutine like:
Code:
SUB MICROPAINT(Param1, param2...)
...
END SUB
And later call it with

Code:
MICROPAINT Param1, Param2... : REM No parenthesis needed

But other than cosmetic syntax, it's exactly the same you have already. In fact this is a classic (static) compiler, like C, BASIC, C++, etc...
So the compiler is not ready for this. I'm not sure whether this will be really useful. The power of C/C++ IMHO resides in their library. C cannot be extended without changing the compiler... though this seems to be changing nowadays.


Re: Extending the language - nitrofurano - 11-10-2011

my main concern is, by complexity, the compiler losing its core flexibility for being a fork base to other machines else zx-spectrum, like c64, msx, samcoupé, atari400/800, zx81, apple2, coco2, 8bit game consoles, stuff like Fuzebox (even these machines not being really 8bit machines, but it lacks good development tools), etc., as planned from Boriel - most of the msx coders (active in the retro scene) i told about Boriel's zxbasic-compiler got amazed about how great is it, and all coded in python, and all curious about how soon a fork of it will appear focusing other 8bit machines as well


Re: Extending the language - boriel - 11-10-2011

I also agree with this. In fact, 2.x branch is headed towards a multi-arch compiler (starting with z80 based micros, like MSX or Amstrad). Later architectures will be even virtual machines or nowadays PCs


Re: Extending the language - nitrofurano - 03-05-2012

boriel Wrote:I also agree with this. In fact, 2.x branch is headed towards a multi-arch compiler (starting with z80 based micros, like MSX or Amstrad). Later architectures will be even virtual machines or nowadays PCs

btw, i added some links about Amstrad on the wiki i think can be helpful - <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Amstrad_CPC">http://www.boriel.com/wiki/en/index.php ... mstrad_CPC</a><!-- m -->
as well, i kept updating <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Other_architectures">http://www.boriel.com/wiki/en/index.php ... hitectures</a><!-- m --> as far as i could (added even some arcade machines there, for surprising misfit-mame users, and because i think these machines are too interesting to be forgotten! Smile )