Changeset 5644 for src/Pugs/CodeGen

Show
Ignore:
Timestamp:
07/17/05 19:41:27 (3 years ago)
Author:
iblech
svk:copy_cache_prev:
7648
Message:

PIL -> JavaScript? compiler.
* Pugs.Compile: Modified the declaration of PApp to accept an invocant.
* Pugs.CodeGen?.PIR: Minor changes because of change #1, pugs -BPIR still passes

the sanity tests.

* New directory perl5/PIL2JS, containing various modules, a README, and

pil2js.pl:
$ pugs -CPIL -Ilib6 -MPrelude::JS -we 'say 2 + 3' | \

./pil2js.pl -html > /tmp/t.html

* t/01-sanity mostly pass! (see

http://m19s28.vlinux.de/iblech/stuff/not_perm/pil2js-demo/)

* t/01-sanity/03-equal.t doesn't pass because of a bug in Pugs.Compile

("3 4" is compiled to "&infix:<>(3, 4)" instead of "&infix:<>(3, {4})"
or something similar.

* See perl5/PIL2JS/README for a list of things which already work.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/CodeGen/PIR.hs

    r5413 r5644  
    108108        tell [thisC] 
    109109        trans rest 
    110     trans (PApp _ exp@(PCode _ _ _) []) = do 
     110    trans (PApp _ exp@(PCode _ _ _) Nothing []) = do 
    111111        blockC  <- trans exp 
    112112        tellIns $ [reg tempPMC] <-& blockC $ [] 
    113113        return tempPMC 
    114     trans (PApp (TCxtLValue _) (PExp (PVar "&postcircumfix:[]")) [PExp lhs, rhs]) = do 
     114    trans (PApp (TCxtLValue _) (PExp (PVar "&postcircumfix:[]")) Nothing [PExp lhs, rhs]) = do 
    115115        lhsC    <- trans lhs 
    116116        rhsC    <- trans rhs 
    117117        return $ lhsC `KEYED` rhsC 
    118     trans (PApp _ fun args) = do 
     118    trans (PApp ctx fun (Just inv) args) = 
     119        trans (PApp ctx fun Nothing (inv:args))  -- XXX wrong 
     120    trans (PApp _ fun Nothing args) = do 
    119121        funC    <- trans fun {- case fun of 
    120122            PExp (PVar name) -> return $ lit name