Versatile Macros
Posted: Thu Jan 18, 2018 11:38 am
No doubt lots of us realized about the inmense posibilities of macros, specially if these are improved with more capabilities.
In order for conversion from other languages to PB there should be more than interesting to improve versatile macros.
Allow names for macros with spaces:
Allow the macro to read the complete line when called and work with it:
In few words:
A powerful versatile Macro shoulds allow the programmer to stablish and to implement the desired rules in order to automatically transform, in complitalion time, any parts of the original source (an unique line of code, or several lines of code) into other code, in our case into PB code.
Macros like that would be the chamaleonic heart of the compiler. Should not?
In order for conversion from other languages to PB there should be more than interesting to improve versatile macros.
Allow names for macros with spaces:
Code: Select all
Macro aaa
Debug "aaa"
EndMacro
Macro aaa
Debug " aaa"
EndMacro
Macro aaa bb
Debug " aaa bb "
EndMacro
aaa
aaa
aaa bb
Code: Select all
Macro Then [ ] ;<- parameters separation are spaces
:
[last:EndIf] ; [last] is the last parameter read in line
EndMacro
If a=9 Then bbb=ccc
Macro Drawimage [,] ; <- compiler calls these macros (with preserved native names) only if the syntax is not correct . Parameters separation are commas.
DisplayTransparentSprite([1](4),[2],[3])
EndMacro
Drawimage imag, cox, coy, num
Macro Drawimage [ ] ; <- compiler calls these macros (with preserved native names) only if the syntax is not correct . Parameters separation are spaces.
DisplayTransparentSprite([1](4),[2],[3])
EndMacro
Drawimage imag cox coy num
A powerful versatile Macro shoulds allow the programmer to stablish and to implement the desired rules in order to automatically transform, in complitalion time, any parts of the original source (an unique line of code, or several lines of code) into other code, in our case into PB code.
Macros like that would be the chamaleonic heart of the compiler. Should not?