On Fri, May 23, 2008 at 4:05 AM, Will Coleda via RT <[EMAIL PROTECTED]> wrote: > On Wed Oct 17 12:09:54 2007, bernhard wrote: >> Currently following PIR is failing because of the '#' in the '.param' list. >> >> .sub main :main >> >> ( $S1 ) = my_sub( 'hello', 'world' ) >> say $S1 >> .end >> >> .sub my_sub >> .param string str1 >> # >> .param string str3 >> >> .local string hello >> hello = concat str1, str3 >> >> .return( hello ) >> .end >> >> >> This surprised me, as I expected that '#' lines would be ignored. >> So I propose to tweak the PIR grammar such that comment lines are allowed >> >> Regards, >> Bernhard >> > > Supporting blank lines between .param would also be a reasonable extension. > I've updated > the tests in t/compilers/imcc/syn/regressions.t to test for those conditions > too. The parser > already allows comments and whitespace before the first .param, just not in > between them. >
IIRC, the blank line stuff in .param lines has to do with the helper_state non-terminal; this is a kludge to make things work currently, as there's a shift/reduce (or reduce/reduce, can't remember) conflict otherwise on the statement (instructions) non-terminal. Parsing of '\n' would ideally be done by both the lexer and parser, to introduce the concept of 'logical newline', representing one or more newlines. I did this in pirc/new, but this is not straightforward, as IMCC's macro parser might get in trouble then. kjs