-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restore menhir parser and handle _ -> int
- Loading branch information
1 parent
98d1e91
commit fa17340
Showing
16 changed files
with
113 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,8 @@ | |
(name query) | ||
(libraries lwt re db)) | ||
|
||
(menhir | ||
(modules type_parser) | ||
(flags --explain)) | ||
|
||
(ocamllex type_lexer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
(* This is a parser for type expressions. It is written in a weird style to | ||
allow for incomplete queries to be reasonably answered. It also has conflicts | ||
for the same reason. They are impossible to solve. | ||
Its behaviour on correct types is tested in [query/test/test_type_parser.ml] | ||
and its behaviour on incomplete types is tested in [test/cram/query_syntax.t/run.t] *) | ||
|
||
%{ | ||
open Db.Typexpr | ||
%} | ||
|
||
%token EOF | ||
%token PARENS_OPEN PARENS_CLOSE | ||
%token ARROW COMMA ANY STAR | ||
%token<string> WORD | ||
%token<string> POLY | ||
|
||
%start main | ||
%type<Db.Typexpr.t> main | ||
|
||
%% | ||
|
||
main: | ||
| t=typ EOF { t } | ||
| EOF { any } | ||
; | ||
|
||
typ: | ||
| a=typ1 ARROW b=typ { arrow a b } | ||
| a=typ1 ARROW EOF { arrow a any } | ||
| ARROW b=typ { arrow any b } | ||
| ARROW EOF { arrow any any } | ||
| t=typ1 { t } | ||
; | ||
|
||
typ1: | ||
| x=typ0 xs=tups { match xs with [] -> x | xs -> tuple (x::xs) } | ||
; | ||
|
||
tups: | ||
| STAR x=typ0 xs=tups { x::xs } | ||
| STAR { [any] } | ||
| EOF { [] } | ||
| { [] } | ||
; | ||
|
||
typ0: | ||
| ANY { any } | ||
| w=POLY { poly w } | ||
| w=WORD { constr w [] } | ||
| t=typ0 w=WORD { constr w [t] } | ||
| PARENS_OPEN ts=typ_list PARENS_CLOSE w=WORD { constr w ts } | ||
| PARENS_OPEN t=typ PARENS_CLOSE { t } | ||
| PARENS_OPEN t=typ EOF { t } | ||
| PARENS_OPEN EOF { any } | ||
; | ||
|
||
typ_list: ts=separated_list(COMMA, typ) { ts } ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.