NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: shaynox on February 20, 2015, 12:47:29 PM
-
Hello, is it possible to write an addon/program, and run it with nasm for modify his comportment while reading the source code, like integrated some new special syntax ?
-
What do you want the addon to do?
My solution to the problem was to write a preprocessor:
http://www.shallizar.com/nasmcollection/Linux/Shallizar/Apps/FileProcessors/PreprocWidgets.html
-
For example, add parenthesis around macro's parameters for look like C-function, give the possibility to write multi instruction in single line without pass through macro*, add new feature support of nasm project (nasm will able to read special configuration file who listed all files it needed to assemble), ...
*: http://forum.nasm.us/index.php?topic=2020.msg9050#msg9050
Unfortunately I don't use Linux.
-
You want to hack NASM's preprocessor, to give it the ability to call your custom functions.
The current version of NASM does not have "hooks" for that.
Modifying NASM is not that difficult. It is one of the tasks I have planned when I get the time.
I need to add support for user-defined types.
If you do hack NASM, just make sure it is crystal clear that a user knows he is using your upgrade.
I WARN all programmers to resist the temptation to indulge in what I call MACRO MADNESS.
Sure, you can write a macro to mimic just about anything in an HLL, but such macros turn into
programs unto themselves. This can seriously set back someone trying to get something done quickly, but
they have to wade through huge macros to understand how to use them. I try to keep my macros as short
as possible, and leave the argument juggling to the called procedure.