Skip to content

Conversation

@kiselgra
Copy link
Owner

I only added support for this for cm-c and cm-cxx. If you feel that the changes are alright, then I'll fix the others.

I mainly want to get your input on the pretty printer code. The outline is:

  • While writing the subnodes of declaration-items, the traverser will not emit comments
  • When the declaration-item is done and has a comment field, the comment is emitted after the ;

My main question is: is there a better way to do this? because getting the comment node itself and accessing the pretty printer was quite fiddely.

@kiselgra kiselgra requested a review from lispbub September 24, 2025 12:34
@kiselgra kiselgra self-assigned this Sep 24, 2025
@kiselgra
Copy link
Owner Author

@lispbub This is the version as discussed, can you give it a quick look?

The following image shows execution times on a current project for running a few files through C-Mera (20 invocations of the same set). The compiled version got quite a bit slower, but using interpretation (see #104) there is not much of a difference.

time-real

`(declaration-value (make-node ,init))
nil))
,@(if comment
`((comment "//" ,comment nil)))))))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really though you could split the comment from the declaration item.
Essentially emitting two nodes from one input.
Then there is no need for a dedicated comment pretty printer.

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

Successfully merging this pull request may close these issues.

3 participants