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

Parser for Vim9 Script #6372

Open
sheerun opened this issue Jul 1, 2020 · 5 comments
Open

Parser for Vim9 Script #6372

sheerun opened this issue Jul 1, 2020 · 5 comments
Labels
enhancement vim9script Vim9 script related issues

Comments

@sheerun
Copy link

sheerun commented Jul 1, 2020

Describe the solution you'd like

If vim source included parser for Vim9 Script (i.e. function that converts source to ast), it would be very useful for implementing highlighting and language servers for Vim9 Script. Currently if one wants to do so he/she needs to create Vim9 parser from scratch... and keep it up do date with changes in it

As far as I can tell from current source vim doesn't generate AST, and compiles code directly instead, yes? Could this be potentially changed to produce AST, maybe as byproduct?

@brammool
Copy link
Contributor

brammool commented Jul 1, 2020

I have considered making a tree representation before producing code. I estimate that it will add quite a bit of overhead and does not have much gain. Creating the tree nodes and later cleaning them up, instead of mostly using stack space, can easily consume a lot of time. The possible gain of producing more efficient code is likely small, unless a full optimizer is used, which is again quite time consuming.
It's still open to give this a try later. Or in a separate branch. I'm now concentrating on making everything work, which is already lots of work to do.

@sheerun
Copy link
Author

sheerun commented Jul 1, 2020

Could tree be created as by-product instead? i.e. as an option

@sheerun
Copy link
Author

sheerun commented Jul 1, 2020

What I mean is: let compiler create AST while parsing, but not use it in any way

@andymass
Copy link

andymass commented Jul 8, 2020

Can a real grammar be written for vim9? In other words, is the vim9 language 'nicely specified' with low context-sensitivity?

@brammool
Copy link
Contributor

brammool commented Jul 8, 2020

Most likely not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement vim9script Vim9 script related issues
Projects
None yet
Development

No branches or pull requests

4 participants