From 554a00c1e5a61d1a2a2767eb091777fbc2a7b811 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 26 Jan 2008 16:51:39 -0500 Subject: Add type keyword --- src/lacweb.grm | 5 ++++- src/lacweb.lex | 1 + tests/stuff.lac | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lacweb.grm b/src/lacweb.grm index 7384dbf8..5d88c3ad 100644 --- a/src/lacweb.grm +++ b/src/lacweb.grm @@ -39,7 +39,8 @@ val s = ErrorMsg.spanOf | SYMBOL of string | CSYMBOL of string | LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE | EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH - | CON | TYPE | NAME + | CON | LTYPE + | TYPE | NAME | ARROW | LARROW | DARROW | FN | PLUSPLUS | DOLLAR @@ -85,6 +86,8 @@ decls : ([]) decl : CON SYMBOL EQ cexp (DCon (SYMBOL, NONE, cexp), s (CONleft, cexpright)) | CON SYMBOL DCOLON kind EQ cexp (DCon (SYMBOL, SOME kind, cexp), s (CONleft, cexpright)) + | LTYPE SYMBOL EQ cexp (DCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp), + s (LTYPEleft, cexpright)) kind : TYPE (KType, s (TYPEleft, TYPEright)) | NAME (KName, s (NAMEleft, NAMEright)) diff --git a/src/lacweb.lex b/src/lacweb.lex index bc5d3af4..88410f2a 100644 --- a/src/lacweb.lex +++ b/src/lacweb.lex @@ -109,6 +109,7 @@ ws = [\ \t\012]; "#" => (Tokens.HASH (yypos, yypos + size yytext)); "con" => (Tokens.CON (yypos, yypos + size yytext)); + "type" => (Tokens.LTYPE (yypos, yypos + size yytext)); "fn" => (Tokens.FN (yypos, yypos + size yytext)); "Type" => (Tokens.TYPE (yypos, yypos + size yytext)); diff --git a/tests/stuff.lac b/tests/stuff.lac index fe692eec..d58c1573 100644 --- a/tests/stuff.lac +++ b/tests/stuff.lac @@ -1,4 +1,4 @@ -con c1 = t :: Type -> t +type c1 = t :: Type -> t con c2 :: Type = t :: Type -> t con c3 = fn t :: Type => c1 con c4 = c3 c1 -- cgit v1.2.3