Changeset 7035 for src/Pugs/Eval.hs

Show
Ignore:
Timestamp:
09/17/05 22:55:58 (3 years ago)
Author:
gaal
Message:

Lexical pragmas (WIP). See Pugs.AST.Prag. Dominus++.
This doesn't work yet, my pragmas got lost somewhere between the parser
and the evaluator.
TODO after it's fixed:
- throw away the cons list in favor of a primitive [] - it's enough
- figure out how to install other kinds of pragma data, not just Int

And, the fun part:
- use fatal
- use sort 'mergesort'
- no strict :-)
- other ideas from http://perl.plover.com/TPF/Pragmas/PROPOSAL

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Eval.hs

    r6918 r7035  
    6161    syms <- initSyms 
    6262    glob <- newTVar (combine (pad ++ syms) $ mkPad []) 
     63    init <- newTVar $ MkInitDat { initPragmas=[] } 
    6364    return $ MkEnv 
    6465        { envContext = CxtVoid 
     
    7778        , envDebug   = Just ref -- Set to "Nothing" to disable debugging 
    7879        , envPos     = MkPos name 1 1 1 1 
     80        , envPragmas = PrNil 
     81        , envInitDat = init 
    7982        } 
    8083 
     
    229232reduce (Stmts this rest) = reduceStmts this rest 
    230233 
     234reduce (Prag prag exp) = reducePrag prag exp 
     235 
    231236reduce (Pos pos exp) = reducePos pos exp 
    232237 
     
    283288            return . VControl $ ControlEnv env 
    284289        _ -> reduce rest 
     290 
     291reducePrag :: Pragmas -> Exp -> Eval Val 
     292reducePrag prag exp = do 
     293    local (\e -> e{ envPragmas = prag }) $ do 
     294        evalExp exp 
    285295 
    286296{-|