- Joined
- Sep 20, 2022
- Messages
- 305
- Reaction score
- 41
I'm trying to design a macro preprocessor that will work with any language.
To make parsing simple, all it needs is one character that is never used by the destination source code. It uses this as an escape character.
Unfortunately, this approach looks a bit hard to read.
For example, escape char
and macro call
produces the line
I don't see any other way that will work with every language.
To make parsing simple, all it needs is one character that is never used by the destination source code. It uses this as an escape character.
Unfortunately, this approach looks a bit hard to read.
For example, escape char
~ with macro definition~{test~;~1,~0 and ~0~}and macro call
~[test~(zip~,zap~)~]produces the line
zap,zip and zip
Code:
~{ begin definitiom
~; seperate name from text
~} end definition
~0 argument
~1 argument
...
~9 argument
~[ begin call
~( begin arguments
~, arguments delimiter
~) end arguments
~] end call