`#` instead of `\\` for comment is fatal in RStan 2.26
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)
Update: I managed to update back up to rstan version 2.26.22 (Stan version 2.26.1) using the officially recommended install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos"))) (instead of that previous StackOverflow-recommended installation command), and can confirm I have the problem there.
> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Ventura 13.3.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.5.2 stringr_1.4.1 dplyr_1.0.10 purrr_0.3.5 readr_2.1.3
[6] tidyr_1.2.1 tibble_3.2.1 ggplot2_3.4.2 tidyverse_1.3.2 rstan_2.26.22
[11] StanHeaders_2.26.22
loaded via a namespace (and not attached):
[1] Rcpp_1.0.10 lubridate_1.8.0 prettyunits_1.1.1 ps_1.7.5 assertthat_0.2.1
[6] utf8_1.2.3 V8_4.3.0 R6_2.5.1 cellranger_1.1.0 backports_1.4.1
[11] reprex_2.0.2 stats4_4.2.1 httr_1.4.4 pillar_1.9.0 rlang_1.1.1
[16] googlesheets4_1.0.1 curl_5.0.0 readxl_1.4.1 rstudioapi_0.14 callr_3.7.3
[21] googledrive_2.0.0 loo_2.6.0 munsell_0.5.0 broom_1.0.1 compiler_4.2.1
[26] modelr_0.1.9 pkgconfig_2.0.3 pkgbuild_1.4.0 tidyselect_1.2.0 gridExtra_2.3
[31] codetools_0.2-18 matrixStats_0.63.0 fansi_1.0.4 crayon_1.5.2 tzdb_0.3.0
[36] dbplyr_2.2.1 withr_2.5.0 grid_4.2.1 jsonlite_1.8.4 gtable_0.3.3
[41] lifecycle_1.0.3 DBI_1.1.3 magrittr_2.0.3 scales_1.2.1 RcppParallel_5.1.7
[46] stringi_1.7.8 cli_3.6.1 fs_1.5.2 xml2_1.3.3 ellipsis_0.3.2
[51] generics_0.1.3 vctrs_0.6.2 tools_4.2.1 glue_1.6.2 hms_1.1.2
[56] processx_3.8.1 parallel_4.2.1 inline_0.3.19 colorspace_2.1-0 gargle_1.2.1
[61] rvest_1.0.3 haven_2.5.1