Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserving Line information and Adding comments with Mixins #16

Open
mariari opened this issue May 18, 2022 · 0 comments
Open

Preserving Line information and Adding comments with Mixins #16

mariari opened this issue May 18, 2022 · 0 comments

Comments

@mariari
Copy link
Member

mariari commented May 18, 2022

Preamble

Currently I don't store any source information when I do my compiler transformations. What this means is that error messages are going to be quite ugly. Further it may be nice to generate out vamp-ir code with comments to describe were certain parts come from

Solution

I can get around this issue by having the saved syntax of a defcircuit wrap a (save-expression-as-current-emited-expression ...) over each top expression in a block. Further we will note the current circuit being defined to give even better information for debugging. save-expression-as-current-emitted-expression will note where the current expression for metadata saving purposes. This will be automatically applied to nodes as they emit to the real body. This can be nested with more save-expression-as-current-emited calls, allowing us to sneak call traces in there for more context when CL functions are used.

The storage of this information is not too bad, as we can use mixin classes to represent the extra source-information and comment functionality.

It's as simple as

(defclass source-mixin ()
   ((%source :initarg :source :reader :source)))

(defclass standalone-ret (source-mixin) ...)

(defmethod add-source ....)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant