Skip to content

Preserving Line information and Adding comments with Mixins #16

@mariari

Description

@mariari

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 ....)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions