Skip to content

Add pkl:syntax module #1569

Draft
stackoverflow wants to merge 2 commits intoapple:mainfrom
stackoverflow:pkl-syntax
Draft

Add pkl:syntax module #1569
stackoverflow wants to merge 2 commits intoapple:mainfrom
stackoverflow:pkl-syntax

Conversation

@stackoverflow
Copy link
Copy Markdown
Contributor

This new stdlib module allows for full manipulation of Pkl source code in Pkl: parsing text to a Pkl CST and formatting a Pkl CST back to text.

@odenix
Copy link
Copy Markdown
Contributor

odenix commented Apr 30, 2026

Have you considered offering the equivalent Java library? Wrapping that library instead of implementing pkl:syntax in Pkl would also improve (especially cold/warm) performance of pkl:syntax.

@HT154
Copy link
Copy Markdown
Contributor

HT154 commented Apr 30, 2026

The major thing missing from this PR is the ability to whole-cloth construct and then format SyntaxNode instances without laboriously creating the underlying Nodes, especially given how common and important code generation is for the Pkl ecosystem. I'm not opposed to offering a Java API (pklpoet?) for this as long as the SyntaxNode classes remain instantiable (not external).

@stackoverflow
Copy link
Copy Markdown
Contributor Author

The Java library is already Node. We still need the classes to be implemented in Pkl because we don't want to offer a generic API to users. As Jen mentioned, we don't want the classes to be external.

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