Pre-Lowering Cassette?

I’ve been working with Cassette, and it’s awesome. Its docs are so good at teaching. I’m not sure if it was @oxinabox who wrote them or what but thank you!

I’m running into some challenges working with the IR, and it’s making me wish I could just do my thing at the Macro level… So here comes the actual question:

My goal is to wrap every single function body with

function f()
        #original body here...
    catch e
        # my injected logic

I could do this with @try_inject function... but I want to do this for all functions that are defined within a certain context.

Is there a way to hook into JuliaSyntax.jl to intercept the parsing before it goes to lowering and apply my own transforms?

I did not write anything much to do with Cassette. Probably @jrevels .

I did start to prototype Arborist.jl to work at the Expr level,
but i never finished it

1 Like