changeset 7:2ce5bf227d01

Add type keyword
author Adam Chlipala <adamc@hcoop.net>
date Sat, 26 Jan 2008 16:51:39 -0500
parents 38bf996e1c2e
children a455a9f85cc3
files src/lacweb.grm src/lacweb.lex tests/stuff.lac
diffstat 3 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lacweb.grm	Sat Jan 26 16:44:39 2008 -0500
+++ b/src/lacweb.grm	Sat Jan 26 16:51:39 2008 -0500
@@ -39,7 +39,8 @@
  | 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 @@
 
 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))
--- a/src/lacweb.lex	Sat Jan 26 16:44:39 2008 -0500
+++ b/src/lacweb.lex	Sat Jan 26 16:51:39 2008 -0500
@@ -109,6 +109,7 @@
 <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));
--- a/tests/stuff.lac	Sat Jan 26 16:44:39 2008 -0500
+++ b/tests/stuff.lac	Sat Jan 26 16:51:39 2008 -0500
@@ -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