I am writing a grammar for a programming language, but I'm running headfirst into a shift/reduce problem. The problem can be found in the state:
fn_call -> ID . L_PAREN fn_args R_PAREN
assignment -> ID . ASSIGN value
assignment -> ID . ASSIGN container
value -> ID
Before explaining a bit further, I want to clarify:
Is this shift/reduce because the program can't determine if I am calling a function or using the ID as a value (eg. constant or variable)?
Moving on, is it possible to fix this? My language does not currently use line delimiters (such as ';' in C or '\n' in Python). The parser is LALR(1).
What is the most efficient (adding the fewest rules to the grammar) way to decipher between a function call or a variable with line delimiters?
EDIT: Here is the lookahead for that state.
! shift/reduce conflict for L_PAREN resolved as shift
L_PAREN shift and go to state 60
ASSIGN shift and go to state 61
COMMA reduce using rule 43 (value -> ID .)
R_PAREN reduce using rule 43 (value -> ID .)
DASH reduce using rule 43 (value -> ID .)
R_BRACE reduce using rule 43 (value -> ID .)
NONE reduce using rule 43 (value -> ID .)
DEFN reduce using rule 43 (value -> ID .)
FOR reduce using rule 43 (value -> ID .)
INT_T reduce using rule 43 (value -> ID .)
DBL_T reduce using rule 43 (value -> ID .)
STR_T reduce using rule 43 (value -> ID .)
ID reduce using rule 43 (value -> ID .)
INT reduce using rule 43 (value -> ID .)
DBL reduce using rule 43 (value -> ID .)
STR reduce using rule 43 (value -> ID .)
COMMENT_LINE reduce using rule 43 (value -> ID .)
L_BRACE reduce using rule 43 (value -> ID .)
SET reduce using rule 43 (value -> ID .)
! L_PAREN [ reduce using rule 43 (value -> ID .) ]