esgv/lambda — Issue #6: F_cking grammer issue
Author: esgv
Created: 2011-11-15 10:07:45+00:00
State: open

Types are only recognized if enclosed into parens:

`fun (x: int) -> x`

Consider this grammar:

```
%token ID ATOMIC_TYPE COLON ARROW

%start Func
%type Func

%%

Func:
| Param ARROW ID { () }

Param:
| ID COLON Type {}
| ID {}

Type:
| ATOMIC_TYPE {}
| Type ARROW Type {}

```

`fsyacc` generates following states:

```
state 7:
items:
Param -> 'ID' 'COLON' Type .
Type -> Type . 'ARROW' Type

actions:
action 'ID' (noprec): reduce Param --> 'ID' 'COLON' Type
action 'ATOMIC_TYPE' (noprec): reduce Param --> 'ID' 'COLON' Type
action 'COLON' (noprec): reduce Param --> 'ID' 'COLON' Type
action 'ARROW' (noprec): shift 10
action 'error' (noprec): reduce Param --> 'ID' 'COLON' Type
action '#' (noprec): reduce Param --> 'ID' 'COLON' Type
action '$$' (noprec): reduce Param --> 'ID' 'COLON' Type

immediate action:
gotos:

state 10:
items:
Type -> Type 'ARROW' . Type

actions:
action 'ID' (noprec): error
action 'ATOMIC_TYPE' (noprec): shift 8
action 'COLON' (noprec): error
action 'ARROW' (noprec): error
action 'error' (noprec): error
action '#' (noprec): error
action '$$' (noprec): error

immediate action:
gotos:
goto Type: 9

```

As you see, state 9 doesn't contain `'FUN' Param 'ARROW' . ID`, while it should do.