aa
com.cliffc.aa.HM.HM4.Lambda2 Class Reference
Inheritance diagram for com.cliffc.aa.HM.HM4.Lambda2:
[legend]
Collaboration diagram for com.cliffc.aa.HM.HM4.Lambda2:
[legend]

Public Member Functions

String p ()
 
final String toString ()
 

Package Functions

 Lambda2 (String arg0, String arg1, Syntax body)
 
T2 find ()
 
T2 hm (Ary< Syntax > work)
 
void live (IBitSet visit)
 
boolean more_work (Ary< Syntax > work)
 
final boolean more_work_impl (Ary< Syntax > work)
 
final SB p0 (SB sb, VBitSet dups)
 
SB p1 (SB sb)
 
SB p2 (SB sb, VBitSet dups)
 
void prep_tree (Syntax par, Ary< Syntax > work)
 
void prep_tree_impl (Syntax par, T2 t, Ary< Syntax > work)
 
T2 prep_tree_lookup (String name, Syntax prior)
 
SB str (SB sb)
 
T2 targ0 ()
 
T2 targ1 ()
 

Package Attributes

final String _arg0
 
final String _arg1
 
final Syntax _body
 
Syntax _par
 
T2 _t
 
T2 _targ0
 
T2 _targ1
 

Detailed Description

Definition at line 189 of file HM4.java.

Constructor & Destructor Documentation

◆ Lambda2()

com.cliffc.aa.HM.HM4.Lambda2.Lambda2 ( String  arg0,
String  arg1,
Syntax  body 
)
package

Definition at line 194 of file HM4.java.

194 { _arg0=arg0; _arg1 = arg1; _body=body; _targ0 = T2.tnew(); _targ1 = T2.tnew(); }

References com.cliffc.aa.HM.HM4.Lambda2._arg0, com.cliffc.aa.HM.HM4.Lambda2._arg1, com.cliffc.aa.HM.HM4.Lambda2._body, com.cliffc.aa.HM.HM4.Lambda2._targ0, com.cliffc.aa.HM.HM4.Lambda2._targ1, and com.cliffc.aa.HM.HM4.T2.tnew().

Here is the call graph for this function:

Member Function Documentation

◆ find()

T2 com.cliffc.aa.HM.HM4.Syntax.find ( )
packageinherited

Definition at line 77 of file HM4.java.

77  { // U-F find
78  T2 t = _t.find();
79  return t==_t ? t : (_t=t);
80  }

References com.cliffc.aa.HM.HM4.Syntax._t, and com.cliffc.aa.HM.HM4.T2.find().

Referenced by com.cliffc.aa.HM.HM4.hm(), com.cliffc.aa.HM.HM4.Con.hm(), com.cliffc.aa.HM.HM4.Ident.hm(), com.cliffc.aa.HM.HM4.Lambda.hm(), com.cliffc.aa.HM.HM4.Lambda2.hm(), com.cliffc.aa.HM.HM4.Let.hm(), com.cliffc.aa.HM.HM4.Apply.hm(), and com.cliffc.aa.HM.HM4.Syntax.more_work_impl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hm()

T2 com.cliffc.aa.HM.HM4.Lambda2.hm ( Ary< Syntax work)
package

Reimplemented from com.cliffc.aa.HM.HM4.Syntax.

Definition at line 200 of file HM4.java.

200  {
201  // The normal lambda work
202  T2 fun = T2.fun(targ0(),targ1(),_body.find());
203  // Force forwards progress; an Apply may already have lifted _t to
204  // something better than just a plain fun wrapper.
205  return find().unify(fun,work);
206  }

References com.cliffc.aa.HM.HM4.Lambda2._body, com.cliffc.aa.HM.HM4.Syntax.find(), com.cliffc.aa.HM.HM4.T2.fun(), com.cliffc.aa.HM.HM4.Lambda2.targ0(), com.cliffc.aa.HM.HM4.Lambda2.targ1(), and com.cliffc.aa.HM.HM4.T2.unify().

Here is the call graph for this function:

◆ live()

void com.cliffc.aa.HM.HM4.Lambda2.live ( IBitSet  visit)
package

Reimplemented from com.cliffc.aa.HM.HM4.Syntax.

Definition at line 221 of file HM4.java.

221  {
222  if( _t!=null ) _t.live(visit);
223  _targ0.live(visit);
224  _targ1.live(visit);
225  _body .live(visit);
226  }

References com.cliffc.aa.HM.HM4.Lambda2._body, com.cliffc.aa.HM.HM4.Syntax._t, com.cliffc.aa.HM.HM4.Lambda2._targ0, com.cliffc.aa.HM.HM4.Lambda2._targ1, com.cliffc.aa.HM.HM4.Syntax.live(), and com.cliffc.aa.HM.HM4.T2.live().

Here is the call graph for this function:

◆ more_work()

boolean com.cliffc.aa.HM.HM4.Lambda2.more_work ( Ary< Syntax work)
package

Reimplemented from com.cliffc.aa.HM.HM4.Syntax.

Definition at line 217 of file HM4.java.

217  {
218  if( !more_work_impl(work) ) return false;
219  return _body.more_work(work);
220  }

References com.cliffc.aa.HM.HM4.Lambda2._body, com.cliffc.aa.HM.HM4.Syntax.more_work(), and com.cliffc.aa.HM.HM4.Syntax.more_work_impl().

Here is the call graph for this function:

◆ more_work_impl()

final boolean com.cliffc.aa.HM.HM4.Syntax.more_work_impl ( Ary< Syntax work)
packageinherited

Definition at line 91 of file HM4.java.

91  {
92  if( work.find(this)!=-1 ) return true; // On worklist, so ok
93  // Check does not make progress
94  int old = T2.CNT; int olen = work._len;
95  boolean more_work;
96  try {
97  T2 t = find();
98  Type con = t._con;
99  T2 hm = hm(null); // Run H-M, with null work, looking for progress
100  T2 un = find().unify(hm,null);
101  more_work = t!=un || con!=un._con || work._len!=olen; // Something happened?
102  assert !more_work;
103  } catch( RuntimeException no_unify ) { more_work=true; } // Fail to unify assert is progress
104  if( !more_work ) T2.CNT=old; // Reset if no error; prevents assert from endlessly raising CNT
105  return !more_work;
106  }

References com.cliffc.aa.HM.HM4.T2._con, com.cliffc.aa.util.Ary< E >._len, com.cliffc.aa.HM.HM4.T2.CNT, com.cliffc.aa.HM.HM4.Syntax.find(), com.cliffc.aa.util.Ary< E >.find(), com.cliffc.aa.HM.HM4.Syntax.hm(), com.cliffc.aa.HM.HM4.Syntax.more_work(), and com.cliffc.aa.HM.HM4.T2.unify().

Referenced by com.cliffc.aa.HM.HM4.Con.more_work(), com.cliffc.aa.HM.HM4.Ident.more_work(), com.cliffc.aa.HM.HM4.Lambda.more_work(), com.cliffc.aa.HM.HM4.Lambda2.more_work(), com.cliffc.aa.HM.HM4.Let.more_work(), and com.cliffc.aa.HM.HM4.Apply.more_work().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ p()

String com.cliffc.aa.HM.HM4.Syntax.p ( )
inherited

Definition at line 111 of file HM4.java.

111 { return p0(new SB(), new VBitSet()).toString(); }

References com.cliffc.aa.HM.HM4.Syntax.p0(), and com.cliffc.aa.util.SB.toString().

Here is the call graph for this function:

◆ p0()

final SB com.cliffc.aa.HM.HM4.Syntax.p0 ( SB  sb,
VBitSet  dups 
)
packageinherited

Definition at line 112 of file HM4.java.

112  {
113  _t.get_dups(dups);
114  _t.str(p1(sb.i()).p(" "), new VBitSet(),dups).nl();
115  return p2(sb.ii(1),dups).di(1);
116  }

References com.cliffc.aa.HM.HM4.Syntax._t, com.cliffc.aa.util.SB.di(), com.cliffc.aa.HM.HM4.T2.get_dups(), com.cliffc.aa.util.SB.i(), com.cliffc.aa.util.SB.ii(), com.cliffc.aa.util.SB.nl(), com.cliffc.aa.util.SB.p(), com.cliffc.aa.HM.HM4.Syntax.p1(), com.cliffc.aa.HM.HM4.Syntax.p2(), and com.cliffc.aa.HM.HM4.T2.str().

Referenced by com.cliffc.aa.HM.HM4.Syntax.p(), com.cliffc.aa.HM.HM4.Lambda.p2(), com.cliffc.aa.HM.HM4.Lambda2.p2(), com.cliffc.aa.HM.HM4.Let.p2(), and com.cliffc.aa.HM.HM4.Apply.p2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ p1()

SB com.cliffc.aa.HM.HM4.Lambda2.p1 ( SB  sb)
package

Reimplemented from com.cliffc.aa.HM.HM4.Syntax.

Definition at line 196 of file HM4.java.

196 { return sb.p("{ ").p(_arg0).p(" ").p(_arg1).p(" -> ... } "); }

References com.cliffc.aa.HM.HM4.Lambda2._arg0, com.cliffc.aa.HM.HM4.Lambda2._arg1, and com.cliffc.aa.util.SB.p().

Here is the call graph for this function:

◆ p2()

SB com.cliffc.aa.HM.HM4.Lambda2.p2 ( SB  sb,
VBitSet  dups 
)
package

Reimplemented from com.cliffc.aa.HM.HM4.Syntax.

Definition at line 197 of file HM4.java.

197 { return _body.p0(sb,dups); }

References com.cliffc.aa.HM.HM4.Lambda2._body, and com.cliffc.aa.HM.HM4.Syntax.p0().

Here is the call graph for this function:

◆ prep_tree()

void com.cliffc.aa.HM.HM4.Lambda2.prep_tree ( Syntax  par,
Ary< Syntax work 
)
package

Reimplemented from com.cliffc.aa.HM.HM4.Syntax.

Definition at line 207 of file HM4.java.

207  {
208  prep_tree_impl(par,T2.tnew(),work);
209  _body.prep_tree(this,work);
210  }

References com.cliffc.aa.HM.HM4.Lambda2._body, com.cliffc.aa.HM.HM4.Syntax.prep_tree(), com.cliffc.aa.HM.HM4.Syntax.prep_tree_impl(), and com.cliffc.aa.HM.HM4.T2.tnew().

Here is the call graph for this function:

◆ prep_tree_impl()

void com.cliffc.aa.HM.HM4.Syntax.prep_tree_impl ( Syntax  par,
T2  t,
Ary< Syntax work 
)
packageinherited

Definition at line 86 of file HM4.java.

86 { _par=par; _t=t; work.push(this); }

References com.cliffc.aa.HM.HM4.Syntax._par, com.cliffc.aa.HM.HM4.Syntax._t, and com.cliffc.aa.util.Ary< E >.push().

Referenced by com.cliffc.aa.HM.HM4.Con.prep_tree(), com.cliffc.aa.HM.HM4.Ident.prep_tree(), com.cliffc.aa.HM.HM4.Lambda.prep_tree(), com.cliffc.aa.HM.HM4.Lambda2.prep_tree(), com.cliffc.aa.HM.HM4.Let.prep_tree(), and com.cliffc.aa.HM.HM4.Apply.prep_tree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prep_tree_lookup()

T2 com.cliffc.aa.HM.HM4.Lambda2.prep_tree_lookup ( String  name,
Syntax  prior 
)
package

Reimplemented from com.cliffc.aa.HM.HM4.Syntax.

Definition at line 212 of file HM4.java.

212  {
213  if( Util.eq(_arg0,name) ) return _targ0;
214  if( Util.eq(_arg1,name) ) return _targ1;
215  return null;
216  }

References com.cliffc.aa.HM.HM4.Lambda2._arg0, com.cliffc.aa.HM.HM4.Lambda2._arg1, com.cliffc.aa.HM.HM4.Lambda2._targ0, com.cliffc.aa.HM.HM4.Lambda2._targ1, and com.cliffc.aa.util.Util.eq().

Here is the call graph for this function:

◆ str()

SB com.cliffc.aa.HM.HM4.Lambda2.str ( SB  sb)
package

Reimplemented from com.cliffc.aa.HM.HM4.Syntax.

Definition at line 195 of file HM4.java.

195 { return _body.str(sb.p("{ ").p(_arg0).p(" ").p(_arg1).p(" -> ")).p(" }"); }

References com.cliffc.aa.HM.HM4.Lambda2._arg0, com.cliffc.aa.HM.HM4.Lambda2._arg1, com.cliffc.aa.HM.HM4.Lambda2._body, com.cliffc.aa.util.SB.p(), and com.cliffc.aa.HM.HM4.Syntax.str().

Here is the call graph for this function:

◆ targ0()

T2 com.cliffc.aa.HM.HM4.Lambda2.targ0 ( )
package

Definition at line 198 of file HM4.java.

198 { T2 targ = _targ0.find(); return targ==_targ0 ? targ : (_targ0=targ); }

References com.cliffc.aa.HM.HM4.Lambda2._targ0, and com.cliffc.aa.HM.HM4.T2.find().

Referenced by com.cliffc.aa.HM.HM4.Lambda2.hm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ targ1()

T2 com.cliffc.aa.HM.HM4.Lambda2.targ1 ( )
package

Definition at line 199 of file HM4.java.

199 { T2 targ = _targ1.find(); return targ==_targ1 ? targ : (_targ1=targ); }

References com.cliffc.aa.HM.HM4.Lambda2._targ1, and com.cliffc.aa.HM.HM4.T2.find().

Referenced by com.cliffc.aa.HM.HM4.Lambda2.hm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

final String com.cliffc.aa.HM.HM4.Syntax.toString ( )
inherited

Definition at line 108 of file HM4.java.

108 { return str(new SB()).toString(); }

References com.cliffc.aa.HM.HM4.Syntax.str(), and com.cliffc.aa.util.SB.toString().

Here is the call graph for this function:

Member Data Documentation

◆ _arg0

final String com.cliffc.aa.HM.HM4.Lambda2._arg0
package

◆ _arg1

final String com.cliffc.aa.HM.HM4.Lambda2._arg1
package

◆ _body

◆ _par

Syntax com.cliffc.aa.HM.HM4.Syntax._par
packageinherited

◆ _t

◆ _targ0

◆ _targ1


The documentation for this class was generated from the following file:
com.cliffc.aa.HM.HM4.Lambda2._body
final Syntax _body
Definition: HM4.java:191
com.cliffc.aa.HM.HM4.T2.str
SB str(SB sb, VBitSet visit, VBitSet dups)
Definition: HM4.java:612
com.cliffc.aa.HM.HM4.Lambda2.targ0
T2 targ0()
Definition: HM4.java:198
com.cliffc.aa.util.Ary.push
E push(E e)
Add element in amortized constant time.
Definition: Ary.java:58
com.cliffc.aa.util.Util.eq
static boolean eq(String s0, String s1)
Definition: Util.java:16
com.cliffc.aa.util.SB.ii
SB ii(int i)
Definition: SB.java:44
com.cliffc.aa.util.SB.di
SB di(int i)
Definition: SB.java:46
com.cliffc.aa.HM.HM4.Syntax.prep_tree_impl
void prep_tree_impl(Syntax par, T2 t, Ary< Syntax > work)
Definition: HM4.java:86
com.cliffc.aa.HM.HM4.Syntax.hm
abstract T2 hm(Ary< Syntax > work)
com.cliffc.aa.type.Type
an implementation of language AA
Definition: Type.java:94
com.cliffc.aa.util.Ary._len
int _len
Definition: Ary.java:13
com.cliffc.aa.HM.HM4.Lambda2._arg1
final String _arg1
Definition: HM4.java:190
com.cliffc.aa.HM.HM4.T2.get_dups
VBitSet get_dups(VBitSet dups)
Definition: HM4.java:599
com.cliffc.aa.HM.HM4.Lambda2.targ1
T2 targ1()
Definition: HM4.java:199
com.cliffc.aa.HM.HM4.Syntax.more_work
abstract boolean more_work(Ary< Syntax > work)
com.cliffc.aa.HM.HM4.T2.tnew
static T2 tnew()
Definition: HM4.java:344
com.cliffc.aa.HM.HM4.Syntax.p2
abstract SB p2(SB sb, VBitSet dups)
com.cliffc.aa.HM.HM4.Lambda2._targ1
T2 _targ1
Definition: HM4.java:193
com.cliffc.aa.util.Util
Definition: Util.java:5
com.cliffc.aa.HM.HM4.Lambda2._arg0
final String _arg0
Definition: HM4.java:190
com.cliffc.aa.HM.HM4.Syntax.find
T2 find()
Definition: HM4.java:77
com.cliffc.aa.util.VBitSet
Definition: VBitSet.java:5
com.cliffc.aa.util.SB
Tight/tiny StringBuilder wrapper.
Definition: SB.java:8
com.cliffc.aa.util.SB.nl
SB nl()
Definition: SB.java:48
com.cliffc.aa.HM.HM4.T2.find
T2 find()
Definition: HM4.java:378
com.cliffc.aa.util.SB.p
SB p(String s)
Definition: SB.java:13
com.cliffc.aa.HM.HM4.T2.live
void live(IBitSet visit)
Definition: HM4.java:372
com.cliffc.aa.HM.HM4.Syntax.more_work_impl
final boolean more_work_impl(Ary< Syntax > work)
Definition: HM4.java:91
com.cliffc.aa.HM.HM4.Syntax.live
abstract void live(IBitSet visit)
com.cliffc.aa.HM.HM4.Syntax.prep_tree
abstract void prep_tree(Syntax par, Ary< Syntax > work)
com.cliffc.aa.HM.HM4.Syntax._par
Syntax _par
Definition: HM4.java:75
com.cliffc.aa.util.SB.i
SB i(int d)
Definition: SB.java:38
com.cliffc.aa.util.Ary.find
int find(E e)
Find the first matching element using ==, or -1 if none.
Definition: Ary.java:192
com.cliffc.aa.HM.HM4.T2.unify
T2 unify(T2 t, Ary< Syntax > work)
Definition: HM4.java:415
com.cliffc.aa.HM.HM4.Syntax.str
abstract SB str(SB sb)
com.cliffc.aa.HM.HM4.Syntax._t
T2 _t
Definition: HM4.java:76
com.cliffc.aa.util.SB.toString
String toString()
Definition: SB.java:62
com.cliffc.aa.HM.HM4.Syntax.p0
final SB p0(SB sb, VBitSet dups)
Definition: HM4.java:112
com.cliffc.aa.HM.HM4.Syntax.p1
abstract SB p1(SB sb)
com.cliffc.aa.HM.HM4.Lambda2._targ0
T2 _targ0
Definition: HM4.java:192