Re: help with parsing

6 views
Skip to first unread message

Bob Carpenter

unread,
Jan 11, 2013, 4:24:00 PM1/11/13
to stan...@googlegroups.com
On 1/11/13 12:56 PM, Jiqiang Guo wrote:
>
> Just realized again I should not use equal sign (=) for assignment. (I just cannot get used to R's <-).

:-) I do that all the time myself. I'll see
if I can produce a better error message than what
we currently have:

EXPECTATION FAILURE LOCATION: file=../temp2/eqs.stan; line=3, column=3

x = 5;
^-- here

DIAGNOSTIC(S) FROM PARSER:
Parser expecting: "}"

What I'll have to do is get it to recognize
the '=' and then reject so I can throw a warning at
the right place.

It is jarring to go back and forth between C++
assignment (=) and R/Stan style (<-). I liked
the idea of using = for Stan, but we finally
decided that <- would be easier for BUGS, JAGS, and
R users.

I used to write R using = for assignment, but
I'd rather follow the standard idioms.

It'd be simple to add = for assignment to Stan,
but I don't like having two symbols that mean the
same thing.

- Bob

Ben Goodrich

unread,
Jan 11, 2013, 4:47:50 PM1/11/13
to stan...@googlegroups.com
On Friday, January 11, 2013 4:24:00 PM UTC-5, Bob Carpenter wrote:
It'd be simple to add = for assignment to Stan,
but I don't like having two symbols that mean the
same thing.

Agreed. As long as the parser throws a message to use <- or ~ instead of =, then I think that is fine.

Ben

Reply all
Reply to author
Forward
0 new messages