General purpose macros

Joined
Sep 20, 2022
Messages
318
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.
 
Joined
Sep 20, 2022
Messages
318
Reaction score
41
This turned out to be a really bad idea.

The source code with macros in it looked awful.

I was trying to make it easier to work with esolangs, but the macros hide the esolang and I end up with an incredibly slow, poorly designed, high-level 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

No members online now.

Forum statistics

Threads
474,471
Messages
2,571,826
Members
48,797
Latest member
PeterSimpson
Top