You can go full metacircular and have the interpreter throw an exception and introspect its traceback, in languages that support that.