I’m probably at about a 1/10 in ampscript. I just don’t use it enough. I tried something like what you are describing but it didn’t work very well. Trying to debug ampscript that runs in an email template at send time by copying into a cloud page and then trying to mimick the various properties only available at send time was just maddening. I can’t comprehend how Salesforce bought such a buggy and poorly thought through piece of junk. It’s a coin toss whether some of the main menus even load half the time. Ergh…
A good article that includes symbol resolution in context
https://www.linuxjournal.com/article/6463