-
Notifications
You must be signed in to change notification settings - Fork 1
Description
With the recent addition of the state keyword, adding the ability to essentially mass create variable definitions would be handy.
Like with macro's, users could define these "variable blocks" with the use of STARTVAR and ENDVAR respectively
STARTVAR
;; variable name till the colon then type in <arrows>
;; defining them like this makes them local to the file this STARTVAR block was inside
string: <INT>
;; global to the entire program, this would be defined at runtime if C-Masm was used. Or interpreted with J-masm
EXPORT path: <QWORD>
ENDVAR
lbl main
mov string 500
DB $500 "Hello, world!\n"
out 1 $string
This would not "phase" out the state declaration syntax but instead allow users to "group" these variables into mass assignments in their programs.
Another feature that addresses pre-processor related things are conditional's and defines.
;DEFINE string, list, path;
;IFDEF string;
mov string 100
;ENDIF;
the user can define a set of "keywords" or something to use within the parsing processor to allow for certain sets of "dead code".
This would allow for platform specific code for things like:
- differences in execution context for things like J-masm vs C-masm
- native code compilation if the user wants to include a native "ASM" block that just gets skipped over.
- conditional code compilation for smaller programs based on system arch.
You get the idea from these yeah?
Implementing something like these, of course with refinement would allow us to have cleaner codebases and to expand on certain things.
For example, we could use these ifdef statements in the standard library so that when the user provides or "Links" with a define that defines veryVerbose, then the compiler or interpreter could provide some debugging code for stack tracing and printing within the program.
These could be used with the new label defining syntax that we added. Though, we should spend time thinking more on what other features could be added to benefit from these swell.