Changeset 32 for src/Prim.hs

Show
Ignore:
Timestamp:
02/16/05 18:48:28 (4 years ago)
Author:
autrijus
svk:copy_cache_prev:
1041
Message:

* Code literals -- "sub", "pointy" and "bare" variants all works
* Lexical subroutine declarations via "my sub"
* Global subroutine and variables work again, via the envGlobal pad
* The "say", "exit", "die" primitives
* Bool.perl now prints correct literals (lwall)
* Blocks under void contexts now evaluates automatically
* The "..." (dotdotdot) literal

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Prim.hs

    r31 r32  
    5858    liftIO . putStr . concatMap vCast . vCast $ v 
    5959    return $ VUndef 
     60op1 "say" = \v -> do 
     61    liftIO . putStrLn . concatMap vCast . vCast $ v 
     62    return $ VUndef 
     63op1 "die" = \v -> do 
     64    return $ VError (concatMap vCast . vCast $ v) (Val v) 
     65op1 "exit" = \v -> do 
     66    if vCast v 
     67        then liftIO $ exitWith (ExitFailure $ vCast v) 
     68        else liftIO $ exitWith ExitSuccess 
    6069 
    6170op1 s      = return . (\x -> VError ("unimplemented unaryOp: " ++ s) (Val x)) 
     
    260269\\n   Num       pre     rand    (?Num=1)\ 
    261270\\n   Action    pre     print   (List)\ 
     271\\n   Action    pre     say     (List)\ 
     272\\n   Action    pre     die     (List)\ 
     273\\n   Any       pre     do      (Str)\ 
    262274\\n   Any       pre     return  (Any)\ 
    263275\\n   Junction  pre     any     (List)\