stan-dev / stan-mode

Emacs mode for Stan.
GNU General Public License v3.0
71 stars 15 forks source link

Remove dependency on cc-mode #44

Closed jrnold closed 5 years ago

jrnold commented 8 years ago

This is a longer-run issue. Remove dependency on cc-mode and write an indentation engine based on smie. I can translate the Stan BNF to an operator-precedence grammar that smie uses. Removing the reliance on cc-mode would be useful because as features are added to the Stan language, it will diverge from C++ syntax.

jrnold commented 8 years ago

Examples of modes using smie from a github search

jrnold commented 8 years ago

@bob-carpenter stan mode has been having some issues with using the built-in cc-mode to parse the grammar (see #47 ). One idea that I've been sitting on is to use emac's smie to write a new indentation engine. Smie uses an operator precedence grammar for its indentation engine because that is usually "good enough" :tm: for indentation (with edge cases handled by custom code). Since you are the languages expert, what do you think?

jrnold commented 8 years ago

From #47 link to smie c-mode http://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/packages/sm-c-mode

bob-carpenter commented 8 years ago

I'm so lazy I haven't even tried installing the latest stan mode, though I've seen Daniel using it and it looks awesome. Auto indent should be good enough for us---we use bog standard indentation other than for the named model blocks (which should format as while loops without a condition).

On Aug 9, 2016, at 5:39 PM, Jeffrey Arnold notifications@github.com wrote:

@bob-carpenter stan mode has been having some issues with using the built-in cc-mode to parse the grammar (see #47 ). One idea that I've been sitting on is to use emac's smie to write a new indentation engine. Smie uses an operator precedence grammar for its indentation engine because that is usually "good enough" ™️ for indentation (with edge cases handled by custom code). Since you are the languages expert, what do you think?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

jrnold commented 8 years ago

s/lazy/efficient/g

kaz-yos commented 5 years ago

Just adding a link to the current Language Syntax: https://mc-stan.org/docs/2_20/reference-manual/language-syntax.html

kaz-yos commented 5 years ago

As of now, cc-mode is still a powerful working solution.