Compiler - Macros/Directives etc... IDEA
Posted: Sun Jun 01, 2003 4:51 am
I have been reading the posts related to compile time capabilities.
I have an idea (WARNING!!! NOT FULLY THOUGHT OUT)
Observation:
Most (if not all) of the request are really aimed towards being able
to manipulate/change information at the point-in-time the source code
gets compiled.
Currently, Constants use the '#' notation (token).
While the existing compiler directives are treated as seperate tokens.
This token now means "Evalute expression at compile time only".
Suggestion:
Why not use the same token (#) to mean that any expression which
follows is to be evalutated only at compile time. For example:
;
;- Constants
;
;Existing capabilities
#Start = 0
#Var_1 = #Start : #Start = #Start + 1
#Var_2 = #Start : #Start = #Start + 1
; New capabilities
#Char_Pos.w = 1
#Char_1.b = #Mid(#String(#PB_Compiler_Date,#Char_Pos,1))
#Char_pos = #Char_Pos = #Char_pos + 1
#Char_2.b = #Mid(#String(#PB_Compiler_Date,#Char_Pos,1))
#Char_pos = #Char_Pos = #Char_pos + 1
This would allow the use of any (Most??) of the commands to act as
a compiler directive/macro language.
OK, FLAME SUIT ON!!! What does everyone think of this?
HarryO
I have an idea (WARNING!!! NOT FULLY THOUGHT OUT)
Observation:
Most (if not all) of the request are really aimed towards being able
to manipulate/change information at the point-in-time the source code
gets compiled.
Currently, Constants use the '#' notation (token).
While the existing compiler directives are treated as seperate tokens.
This token now means "Evalute expression at compile time only".
Suggestion:
Why not use the same token (#) to mean that any expression which
follows is to be evalutated only at compile time. For example:
;
;- Constants
;
;Existing capabilities
#Start = 0
#Var_1 = #Start : #Start = #Start + 1
#Var_2 = #Start : #Start = #Start + 1
; New capabilities
#Char_Pos.w = 1
#Char_1.b = #Mid(#String(#PB_Compiler_Date,#Char_Pos,1))
#Char_pos = #Char_Pos = #Char_pos + 1
#Char_2.b = #Mid(#String(#PB_Compiler_Date,#Char_Pos,1))
#Char_pos = #Char_Pos = #Char_pos + 1
This would allow the use of any (Most??) of the commands to act as
a compiler directive/macro language.
OK, FLAME SUIT ON!!! What does everyone think of this?
HarryO