aya-dev icon indicating copy to clipboard operation
aya-dev copied to clipboard

A faithful pretty printer

Open ice1000 opened this issue 3 years ago • 9 comments

There should be a pretty printer that only adds highlight/links/attributes to the input code, and doesn't change anything in the output. Similar to Agda's literate mode.

Implementation wise, I guess it's something that traverse the tree while holding an iterator of the token sequence. We could start from SyntaxHighlight.java

ice1000 avatar Aug 31 '22 07:08 ice1000

Like some RainbowVisitor?

imkiva avatar Aug 31 '22 07:08 imkiva

Like some RainbowVisitor?

Well I'm not sure wdym by rainbow visitor. I think the one in intellij is unrelated

ice1000 avatar Aug 31 '22 07:08 ice1000

@ice1000 JB's RainbowVisitor uses the same method as you said

imkiva avatar Aug 31 '22 07:08 imkiva

@imkiva I see. Seems I don't understand jb as much as you do lol

ice1000 avatar Aug 31 '22 07:08 ice1000

We already have it: SyntaxHighlight.java. But it needs some generalization.

imkiva avatar Aug 31 '22 09:08 imkiva

We already have it: SyntaxHighlight.java. But it needs some generalization.

Most likely we're going to migrate to GK so it should worth doing this task later

ice1000 avatar Aug 31 '22 12:08 ice1000

We already have it: SyntaxHighlight.java. But it needs some generalization.

Most likely we're going to migrate to GK so it should worth doing this task later

Are we going to perform annotation together with parsing? If not, this issue might not depend on a GK parser.

imkiva avatar Aug 31 '22 12:08 imkiva

We already have it: SyntaxHighlight.java. But it needs some generalization.

Most likely we're going to migrate to GK so it should worth doing this task later

Are we going to perform annotation together with parsing? If not, this issue might not depend on a GK parser.

The GK parser will surely deprecate the current Aya Lexer I guess

ice1000 avatar Aug 31 '22 12:08 ice1000

Now we can work on this!!

ice1000 avatar Oct 08 '22 03:10 ice1000

We already have it: SyntaxHighlight.java. But it needs some generalization.

SyntaxHighlight looks don't add any links.

HoshinoTented avatar Nov 18 '22 07:11 HoshinoTented

We already have it: SyntaxHighlight.java. But it needs some generalization.

SyntaxHighlight looks don't add any links.

Seems that we need to combine SyntaxHighlight and some code in CoreDistiller...

ice1000 avatar Nov 18 '22 11:11 ice1000

It would be nice if we can reuse these code. At least, SyntaxHighlight should be reused.

ice1000 avatar Nov 18 '22 11:11 ice1000

Seems that we need to combine SyntaxHighlight and some code in CoreDistiller...

But the SyntaxHighlither/FaithfulDistiller will work with Concretes instead of Cores. However, this is not a serious problem.

HoshinoTented avatar Nov 18 '22 11:11 HoshinoTented

I agree. By CoreDistiller I probably only mean the pp of those DefVars, which are still present in concrete

ice1000 avatar Nov 18 '22 12:11 ice1000