summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-01-26 16:51:39 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-01-26 16:51:39 -0500
commit554a00c1e5a61d1a2a2767eb091777fbc2a7b811 (patch)
tree81376d4bac8a1ba684cd5911ed44b86309b87d3b
parent53109d697cd8ff1aa7e4b8c41f3bd71dd2671fc0 (diff)
Add type keyword
-rw-r--r--src/lacweb.grm5
-rw-r--r--src/lacweb.lex1
-rw-r--r--tests/stuff.lac2
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];
<INITIAL> "#" => (Tokens.HASH (yypos, yypos + size yytext));
<INITIAL> "con" => (Tokens.CON (yypos, yypos + size yytext));
+<INITIAL> "type" => (Tokens.LTYPE (yypos, yypos + size yytext));
<INITIAL> "fn" => (Tokens.FN (yypos, yypos + size yytext));
<INITIAL> "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