Changeset 13927 for src/Pugs/AST.hs

Show
Ignore:
Timestamp:
10/05/06 14:31:33 (2 years ago)
Author:
audreyt
Message:

* Pugs.AST, Pugs.Run: Instead of registering macros for

types that expands to their protopes as eponymous functions:

$x = Int; # used to calls the &Int macro

they are now instead registered under the "term:" grammatical
category:

$x = Int; # now calls the &term:<Int> macro

this is very good, as it allows separate slots for &term:<int>
(the macro for the builtin unboxed type "int"), as well as for
&int (the function for the unary caster).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/AST.hs

    r13923 r13927  
    263263 
    264264newType :: String -> Exp 
    265 newType name = _Sym SGlobal ('&':'&':'*':name) $! Syn ":=" 
    266     [ _Var ('&':'*':name) 
     265newType name = _Sym SGlobal ('&':'&':'*':termName) $! Syn ":=" 
     266    [ _Var ('&':'*':termName) 
    267267    , typeMacro name (Val . VType . mkType $ name) 
    268268    ] 
     269    where 
     270    termName = "term:" ++ name 
     271 
    269272 
    270273newMetaType :: String -> Exp 
    271 newMetaType name = _Sym SGlobal ('&':'&':'*':name) $! Syn ":=" 
    272     [ _Var ('&':'*':name) 
     274newMetaType name = _Sym SGlobal ('&':'&':'*':termName) $! Syn ":=" 
     275    [ _Var ('&':'*':termName) 
    273276    , typeMacro name (_Var (':':'*':name)) 
    274277    ] 
     278    where 
     279    termName = "term:" ++ name 
    275280 
    276281typeMacro :: String -> Exp -> Exp 
    277282typeMacro name exp = Syn "sub" . (:[]) . Val . VCode $ MkCode 
    278283    { isMulti       = True 
    279     , subName       = cast ('&':name) 
     284    , subName       = cast ("&term:" ++ name) 
    280285    , subEnv        = Nothing 
    281286    , subType       = SubMacro 
     
    283288    , subReturns    = typ 
    284289    , subLValue     = False 
    285     , subParams     = [defaultHashParam{ paramName = cast "%?" }] 
     290    , subParams     = [ defaultArrayParam, defaultHashParam ] 
    286291    , subBindings   = [] 
    287292    , subSlurpLimit = []