General purpose macros

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 ~ 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
I don't see any other way that will work with every language.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,444
Messages
2,571,708
Members
48,796
Latest member
Greg L.
Top