nand2tetris / web-ide

A web-based IDE for https://nand2tetris.org
https://nand2tetris.github.io/web-ide
Other
85 stars 22 forks source link

Add compile jack comand to cli #459

Closed happytomatoe closed 2 months ago

happytomatoe commented 2 months ago

As I am not using web-ide jack editor because it's slow, I've decided to add cli command to invoke Jack compiler directly

Screenshot from 2024-09-16 17-03-14

DavidSouther commented 2 months ago

@happytomatoe thank you so much for this PR! Definitely something we've had as a wishlist item while our effort has been focused on the web IDE. For your purposes, you might also look into a "CLI runner", that provides a CLI or (lightweight) windowed environment for Screen + Keyboard. I'll have a review for you later today. It looks like you can start by running npm run ci locally to ensure your CI will pass, and npm run format ; npm run fix to apply automatic formatting and lint fixes.

happytomatoe commented 2 months ago

@DavidSouther Could you elaborate on CLI runner? Currently incli/src/index.tsI see that run command only accepts.tstfiles

DavidSouther commented 2 months ago

I see that run command only accepts.tstfiles

Yes; this would be an entirely new project. nand2tetris run file.tst would still run a .tst file as expected. This new mode might be nand2tetris exec myprog.hack, where myprog.hack is the final compiled .jack -> vm -> hack binary file. This mode would then have the screen and keyboard interaction. Maybe we should start a new thread to discuss that!

DavidSouther commented 2 months ago

Thank you @happytomatoe for your first PR!