stan-dev / stan-dev/rstan

`#` instead of `\\` for comment is fatal in RStan 2.26

Open
#1,067 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Summary:

Using # instead of \\ to begin a comment in RStan 2.26 resulted in fatal mysterious parser failed badly error.

Description:

I encountered this error in RStan 2.26. I tried to update to see if it persists in a more recent version by removing RStan and reinstalling with remotes::install_github("stan-dev/rstan", subdir = "rstan/rstan"); unfortunately this fails to install (with nothing more informative than clang: error: linker command failed with exit code 1, which I don't know how to solve). So I'm now back on RStan 2.21.0 from CRAN, for which the problem is not fatal and gives the desired Info: Comments beginning with # are deprecated. Please use // in place of # for line comments.

Reproducible Steps:

Before I downgraded from RStan 2.26, this Stan program gave the error

data {
  int<lower = 1> N;
  vector[N] y;
}

parameters {
  real mu;
  real<lower = 0> sigma;
}

# test comment
model {
  y ~ normal(mu, sigma);
}
Expected Output:

I would expect Info: Comments beginning with # are deprecated. Please use // in place of # for line comments on any version of RStan (or at least an explanation of the problem even if it's fatal).

RStan Version:

2.26 (point-something-else which I can no longer remember)

R Version:

4.2.1

Operating System:

macOS Ventura Version 13.3.1 (a)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied Stan program with RStan 2.26, then compare its behavior with RStan 2.21.0. Investigate the parser handling of the # comment and determine whether it can report the deprecation message instead of failing; done means the behavior is covered by a regression test and no longer produces the fatal parser error.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.