8

I'm playing with the Raku Grammar feature in the Comma IDE. It's pretty cool. I can code by limitless trial and error which is what I do best.

However, it's frequently getting stuck (maybe once every 5 to 10 minutes). It's probably a result of my bad code.

Regardless, is there a way to reset it without having to restart the IDE? I've tried changing my grammar. Sometimes that works but often it does not.

Thanks.

StevieD
  • 6,925
  • 2
  • 25
  • 45
  • 2
    Raku's grammar "formalism" is (deliberately) [Turing complete](https://en.wikipedia.org/wiki/Turing_completeness). Positives include power; if *any* parser can be written to parse some text in *any* programming language, then a Raku grammar can encode that parser, and can match that other parser's O(N) performance. Negatives include that you can encode infinite loops. If it's getting stuck, assume you've written an infinite loop; does it work to just stop it the same way you do for any other program with an infinite loop? – raiph Mar 21 '22 at 22:07
  • 2
    Questions about Comma here on SO sometimes get attention and/or an answer from the team working on Comma, but if you want a response from them, I recommend you email them at `info@commaide.com`. (Perhaps following the guidance in [this SO answer](https://stackoverflow.com/a/65657337/1077672) about info to provide them. Also be aware of the moving target aspects related to IntelliJ updates mentioned in [this answer](https://stackoverflow.com/a/63583427/1077672).) – raiph Mar 21 '22 at 22:32
  • 1
    I see no good, reliable way to stop or interrupt the process despite searching for one. If it gets stuck and I revert the code, it will often remain stuck. Also, in the middle of changing the the code, before I'm finished making changes it can get stuck. I just paid for the licensed version. Hoping it helps. – StevieD Mar 22 '22 at 01:31
  • 1
    So far, the paid version of Comma seems much more stable. I'm guessing the improvements will probably get rolled into the next free release. – StevieD Mar 22 '22 at 17:03
  • Well, that's mixed news for me. It's obviously good if it's more stable. My guess is the problem is JetBrains/IntelliJ. When I explored IntelliJ forums a couple years ago to understand other SO's complaining about Comma instability it became clear that JetBrains weren't keep things especially stable, and weren't properly reporting about what they'd changed/broken between versions. So the Comma team presumably have their work cut out to keep things smooth. That said, if they *don't* ensure Community catches up soon (maybe *two* releases behind, but preferably not), I'd be disappointed. – raiph Mar 22 '22 at 21:40
  • 2
    fwiw IntelliJ is pushing the envelope to split the IDE into server / client so that (eg) a server can run within a "docker-compose" on some linux cloud instance and the client can run on your laptop. This is a general architecture change and not language specific and looks to be an awesome improvement. I have been playing with IntelliJ IDEA with Comma plugin and since late 2021 has the client/server model with ssh and also stuff like connecting to a macOS Docker Desktop so you can have a container for running test... – librasteve Mar 24 '22 at 20:21

1 Answers1

3

I found a slightly better way to try to keep the previewer from getting stuck:

  1. create another grammar in the same file with just token TOP { .+ } in it.

  2. If it gets stuck, switch to the othe grammar. This will divert Comma's attention away from the real grammar.

  3. Mkae any changes to the code to try to fix the problem in the real grammar.

  4. Switch back to real grammar. Often, it will start working again.

Also, the grammar checker can spawn several rakudo zombie processes. Be sure to kill those or they will eat up your CPU and memory very quickly.

StevieD
  • 6,925
  • 2
  • 25
  • 45