Changeset 7843 for src/Pugs/Parser.hs

Show
Ignore:
Timestamp:
11/05/05 11:41:57 (3 years ago)
Author:
autrijus
Message:

[Massive backport from svn.perl.org now openfoundry is back]

* theorbtwo notes that FIRST {} blocks did not

desugar into anything that passes PIL compilation,
as it's useing a Stmt in LValue position.
Fixed by desugaring using ternary if.

* Squash an empty import warning for precompiled preludes.

* Support for "./pugs -C PIL2".

Currently, "-C PIL" and "-C PIL1" both maps to PIL1,
but some day "-C PIL" may change to PIL2.

* Repo copy Pugs.CodeGen?.PIL to Pugs.CodeGen?.PIL2
* Also rename CodeGen?.PIL to CodeGen?.PIL1

* Add DrIFT-generated source of PIL2.hs.

* Repo copy PIL1 to PIL2 for the long-much-overdue PIL2

refactoring. The goals are:

  • Compile time object serialization
  • Lexical hoisting
  • Static creation of Code objects with scope (no PSub forms)
  • Full Cxt information
  • PIL2 is *after* type erasure -- *no* static type annotation should be left after that -- it's somewhere between F<: and ANF, so to speak.

* Adds support for "./pugs -BPugs -e ...", which just takes

-CPugs output and feed to the "runghc" executable in PATH.

* pugscc: chase the s/MainCC.mainCC/Main.main/ change

as the now-cabalized Pugs package no longer exports "main".

* Compile-time objects now survives "./pugs -CPugs" compilation.

This means the line below works now:

pugscc -e 'class F {}; my $x ::= F.new; say $x'

Previously, the ::= would prevent compilation because we
did not have a serialization protocol for VObject types.
(This work is going to be carried over to PIL.)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Parser.hs

    r7815 r7843  
    984984    --   state $?FIRST_RESULT; 
    985985    --   state $?FIRST_RUN; 
    986     --   $?FIRST_RUN || { $?FIRST_RUN++; $?FIRST_RESULT = { 42 }() }; 
    987     --   $?FIRST_RESULT; 
     986    --   $?FIRST_RUN++ ?? $?FIRST_RESULT !! $?FIRST_RESULT = { 42 }(); 
    988987    -- } 
    989988    -- These are the two state variables we need. 
     
    994993    return $ Syn "block"        -- The outer block 
    995994        [ Pad SState lexDiff $  -- state ($?FIRST_RESULT, $?FIRST_RUN); 
    996             Stmts (App (Var "&infix:||")    --  $?FIRST_RUN || 
    997                 Nothing 
    998                 [ Var "$?FIRST_RUN" 
    999                 , Stmts (App (Var "&postfix:++") Nothing [Var "$?FIRST_RUN"]) 
    1000                         (Syn "=" [Var "$?FIRST_RESULT", App (Val code) Nothing []]) 
    1001                 ])   --  { $?FIRST_RUN++; $?FIRST_RESULT = { 42 }() }; 
    1002             (Var "$?FIRST_RESULT") --  $?FIRST_RESULT; 
     995            Syn "if" 
     996                [ App (Var "&postfix:++") Nothing [Var "$?FIRST_RUN"] 
     997                , Var "$?FIRST_RESULT" 
     998                , Syn "=" [Var "$?FIRST_RESULT", App (Val code) Nothing []] 
     999                ]   --  { $?FIRST_RUN++; $?FIRST_RESULT = { 42 }() }; 
    10031000        ] 
    10041001