From 1a829ea4e099e0cd5397e41458813b4cc942174b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9onard=20G=C3=A9rard?= Date: Thu, 24 Jun 2010 05:05:58 +0200 Subject: [PATCH] Mls parser tweak, todos and co added --- compiler/minils/mls_parser.mly | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/compiler/minils/mls_parser.mly b/compiler/minils/mls_parser.mly index 84609f0..173847c 100644 --- a/compiler/minils/mls_parser.mly +++ b/compiler/minils/mls_parser.mly @@ -90,6 +90,9 @@ let mk_var name ty = mk_var_dec name ty %% +/*TODO deal with when merge and co*/ +/*TODO add arrow ?*/ +/*TODO be happy with the tools*/ /** Tools **/ @@ -120,28 +123,25 @@ program: p_nodes = $4; p_consts = []}} /*TODO consts dans program*/ +pragma_headers: l=option_list(pragma) {l} pragma: p=PRAGMA {p} -pragma_headers: l=option_list(pragma) {l} - - +open_modules: l=option_list(opens) {l} opens: OPEN c=CONSTRUCTOR {c} -open_modules: l=option_list(opens) {l} - +ident: n=NAME | LPAREN n=infix RPAREN | LPAREN n=prefix RPAREN { n } field_type : n=NAME COLON t=type_ident { (n, t) } type_ident: NAME { Tid(Name($1)) } +type_decs: t=option_list(type_dec) {t} type_dec: | TYPE n=NAME { mk_type n Type_abs } | TYPE n=NAME EQUAL e=slist(BAR,NAME) { mk_type n (Type_enum e) } | TYPE n=NAME EQUAL s=structure(field_type) { mk_type n (Type_struct s) } -type_decs: t=option_list(type_dec) {t} - - +node_decs: ns=option_list(node_dec) {ns} node_dec: NODE id=ident LPAREN args=params RPAREN RETURNS LPAREN out=params RPAREN vars=loc_vars LET eqs=equs TEL @@ -152,8 +152,6 @@ node_dec: ~eq: eqs id } -node_decs: ns=option_list(node_dec) {ns} - params: p=option_slist(SEMICOL, var) {p} loc_vars: @@ -164,17 +162,13 @@ var: | ns=slist(COMMA, NAME) COLON t=type_ident { List.map (fun id -> mk_var id t) ns } -equ: p=pat EQUAL e=exp { mk_eq p e } - - equs: e=option_slist(SEMICOL, equ) ?SEMICOL {e} - +equ: p=pat EQUAL e=exp { mk_eq p e } pat: | n=NAME {Evarpat (ident_of_name n)} | LPAREN p=slist(COMMA, pat) RPAREN {Etuplepat p} - longname: l=qualified(ident) {l} constructor: @@ -219,8 +213,6 @@ exp: { make_exp (Efield($1, $3)) } -ident: n=NAME | LPAREN n=infix RPAREN | LPAREN n=prefix RPAREN { n } - %inline infix: | op=INFIX0 | op=INFIX1 | op=INFIX2 | op=INFIX3 | op=INFIX4 { op } | STAR { "*" }