Open happytomatoe opened 1 month ago
@DavidSouther @netalondon Could you please take a look?
Upd: I've added validate method to the compiler. Now after each keystroke time of execution is under 100ms for many big files.
qq - why do we write VM files on disk?
@DavidSouther @netalondon just FYI - I've created new repo for jack language server protocol, I would gladly contribute this to nand2tetris repo. About this PR - I would rather have extract compiler into its' own package because of the new repo
Great work in here, I've been following your WIP as it goes.
We're happy to have the LSP in this repo, we just need to spend a bit thinking through where it will go, how to extend it to the other languages, and how to integrate it with the web, cli, and ide extensions.
Again, your use case as a "Jack developer" is relatively niche in the NAND2Tetris community. The vast bulk of work happens at the Hack level, and a little bit at the VM and assembly levels. Improvements to those will have the most impact for NAND2Tetris students.
So finding a migration path from the current state to your ANTLR based approach is a good project for quarter, if someone wanted to pick that up.
Are you ready for me to review this PR?
@DavidSouther Please go ahead. There is a possibility that I can find some small bugs. I can create another PR, if you would like, to fix them.
So finding a migration path from the current state to your ANTLR based approach is a good project for quarter, if someone wanted to pick that up.
@DavidSouther Can you create a new repo? I would provide the scaffolding along with the jack lsp implementation
As you can see that 1 key stroke calls compiler 2 times on screenshot.
In dev, yes; in production, it should still only be called once. That said, we can probably make better use of effects to ensure it happens only once either way.
So finding a migration path from the current state to your ANTLR based approach is a good project for quarter, if someone wanted to pick that up.
@DavidSouther Can you create a new repo? I would provide the scaffolding along with the jack lsp implementation
Nvm. I don't want to spend my time on that.
So finding a migration path from the current state to your ANTLR based approach is a good project for quarter, if someone wanted to pick that up.
@DavidSouther Can you create a new repo? I would provide the scaffolding along with the jack lsp implementation
Nvm. I don't want to spend my time on that.
After we get this compiler in, I think we can look at putting the LSP server in a new folder, server
. I prefer monorepo development for contained projects like this that are highly reliant on one another.
@happytomatoe I hope you're able to keep making progress on this, but I wanted to let you know that I'm unavailable for the coming week. I'll be back October 20th to review any changes.
@happytomatoe I hope you're able to keep making progress on this, but I wanted to let you know that I'm unavailable for the coming week. I'll be back October 20th to review any changes.
Have a nice holiday if it's a holiday)
Small update - I was fed up working with official antlr4 typescript target. Migrated to antlr4ng
Small update - I was fed up working with official antlr4 typescript target. Migrated to antlr4ng
Have you looked at Treesitter at all? (question, not a suggestion, but I hear great things about it and might be where I'd start if I was going from scratch today).
Small update - I was fed up working with official antlr4 typescript target. Migrated to antlr4ng
Have you looked at Treesitter at all? (question, not a suggestion, but I hear great things about it and might be where I'd start if I was going from scratch today).
What do you hear specifically? It's a pure C library with language bindings. I didn't work with such combination. Probably it has it's own pain points. I don't know. I've seen this tool when I was building prettier plugin for Jack as it can build syntax tree(Tree with whitespaces and comments.)
If you would build this from scratch, based on my experience, the most go to options are
Testing is done from my subjective point of view.
Improved Jack compiler. Underneath the covers it uses ANTLR List of improvements:
Cons:
Don't get scared because it says 13k LOC. Most of it are tests and test files. The src changes is around 1k LOC. This doesn't include the generated files.
You can check it out on https://happytomatoe.github.io/web-ide/compiler
TODO: