aa
com.cliffc.aa.HM.HM3.Lambda Class Reference
Inheritance diagram for com.cliffc.aa.HM.HM3.Lambda:
[legend]
Collaboration diagram for com.cliffc.aa.HM.HM3.Lambda:
[legend]

Public Member Functions

String toString ()
 

Protected Member Functions

final void add_work (Worklist work)
 

Package Functions

 Lambda (String arg0, Syntax body)
 
final void add_neighbors (Worklist work)
 
final boolean all_kids_ready ()
 
boolean check_progress (Worklist work)
 
void get_ids (VStack vstk, Worklist work)
 
HMType hm (Worklist work)
 
boolean progress ()
 

Package Attributes

final String _arg0
 
HMType _hm
 
Syntax[] _kids
 
Syntax _par
 

Private Member Functions

Syntax body ()
 

Detailed Description

Definition at line 189 of file HM3.java.

Constructor & Destructor Documentation

◆ Lambda()

com.cliffc.aa.HM.HM3.Lambda.Lambda ( String  arg0,
Syntax  body 
)
package

Definition at line 191 of file HM3.java.

191 { _kids=new Syntax[]{body}; body._par=this; _arg0=arg0; }

References com.cliffc.aa.HM.HM3.Lambda._arg0, com.cliffc.aa.HM.HM3.Syntax._kids, com.cliffc.aa.HM.HM3.Syntax._par, and com.cliffc.aa.HM.HM3.Lambda.body().

Here is the call graph for this function:

Member Function Documentation

◆ add_neighbors()

final void com.cliffc.aa.HM.HM3.Syntax.add_neighbors ( Worklist  work)
packageinherited

Definition at line 128 of file HM3.java.

128  {
129  if( _par!=null ) _par.add_work(work);
130  if( _kids!=null )
131  for( Syntax kid : _kids )
132  kid.add_work(work);
133  }

References com.cliffc.aa.HM.HM3.Syntax._kids, com.cliffc.aa.HM.HM3.Syntax._par, and com.cliffc.aa.HM.HM3.Syntax.add_work().

Referenced by com.cliffc.aa.HM.HM3.hm().

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

◆ add_work()

final void com.cliffc.aa.HM.HM3.Syntax.add_work ( Worklist  work)
protectedinherited

Definition at line 126 of file HM3.java.

126 { if( all_kids_ready() ) work.push(this); }

References com.cliffc.aa.HM.HM3.Syntax.all_kids_ready(), and com.cliffc.aa.HM.HM3.Worklist.push().

Referenced by com.cliffc.aa.HM.HM3.Syntax.add_neighbors(), com.cliffc.aa.HM.HM3.Con.get_ids(), and com.cliffc.aa.HM.HM3.Ident.get_ids().

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

◆ all_kids_ready()

final boolean com.cliffc.aa.HM.HM3.Syntax.all_kids_ready ( )
packageinherited

Definition at line 135 of file HM3.java.

135  {
136  if( _kids==null ) return true;
137  for( Syntax kid : _kids ) if( kid._hm==null ) return false;
138  return true;
139  }

References com.cliffc.aa.HM.HM3.Syntax._kids.

Referenced by com.cliffc.aa.HM.HM3.Syntax.add_work(), and com.cliffc.aa.HM.HM3.Syntax.check_progress().

Here is the caller graph for this function:

◆ body()

Syntax com.cliffc.aa.HM.HM3.Lambda.body ( )
private

Definition at line 192 of file HM3.java.

192 { return _kids[0]; }

References com.cliffc.aa.HM.HM3.Syntax._kids.

Referenced by com.cliffc.aa.HM.HM3.Lambda.get_ids(), com.cliffc.aa.HM.HM3.Lambda.hm(), com.cliffc.aa.HM.HM3.Lambda.Lambda(), com.cliffc.aa.HM.HM3.Lambda.progress(), and com.cliffc.aa.HM.HM3.Lambda.toString().

Here is the caller graph for this function:

◆ check_progress()

boolean com.cliffc.aa.HM.HM3.Syntax.check_progress ( Worklist  work)
packageinherited

Definition at line 144 of file HM3.java.

144  {
145  if( all_kids_ready() ) // If kids are not ready, then cannot compute hm() so not on worklist
146  if( _hm==null || progress() ) // Progress is possible
147  if( !work.has(this) ) // Not on worklist?
148  return false; // Fails check
149  if( _kids!=null ) // For all kids
150  for( Syntax kid : _kids )
151  if( !kid.check_progress(work) ) // Recursively check nodes that can make progress on worklist
152  return false;
153  return true;
154  }

References com.cliffc.aa.HM.HM3.Syntax._hm, com.cliffc.aa.HM.HM3.Syntax._kids, com.cliffc.aa.HM.HM3.Syntax.all_kids_ready(), com.cliffc.aa.HM.HM3.Worklist.has(), and com.cliffc.aa.HM.HM3.Syntax.progress().

Referenced by com.cliffc.aa.HM.HM3.hm().

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

◆ get_ids()

void com.cliffc.aa.HM.HM3.Lambda.get_ids ( VStack  vstk,
Worklist  work 
)
package

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

Definition at line 211 of file HM3.java.

211  {
212  HMVar var = new HMVar();
213  ENV.put(_arg0, var);
214  body().get_ids(new VStack(vstk,var),work);
215  }

References com.cliffc.aa.HM.HM3.Lambda._arg0, com.cliffc.aa.HM.HM3.Lambda.body(), com.cliffc.aa.HM.HM3.ENV, and com.cliffc.aa.HM.HM3.Syntax.get_ids().

Here is the call graph for this function:

◆ hm()

HMType com.cliffc.aa.HM.HM3.Lambda.hm ( Worklist  work)
package

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

Definition at line 194 of file HM3.java.

194  {
195  if( _hm!=null && !progress() ) return null;
196  HMType tnew = ENV.get(_arg0).find();
197  HMType trez = body()._hm.find();
198  return Oper.fun(tnew,trez);
199  }

References com.cliffc.aa.HM.HM3.Lambda._arg0, com.cliffc.aa.HM.HM3.Syntax._hm, com.cliffc.aa.HM.HM3.Lambda.body(), com.cliffc.aa.HM.HM3.ENV, com.cliffc.aa.HM.HM3.HMType.find(), com.cliffc.aa.HM.HM3.Oper.fun(), and com.cliffc.aa.HM.HM3.Lambda.progress().

Here is the call graph for this function:

◆ progress()

boolean com.cliffc.aa.HM.HM3.Lambda.progress ( )
package

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

Definition at line 200 of file HM3.java.

200  {
201  HMType tnew = ENV.get(_arg0).find();
202  HMType trez = body()._hm.find();
203  // Progress if _hm is NOT a Oper.fun, OR
204  // !_hm[0].eq(tnew) || _hm[1].eq(trez);
205  if( !(_hm instanceof Oper) ) return true;
206  if( !((Oper)_hm)._name.equals("->") ) return true;
207  HMType fcn = ((Oper)_hm)._args[0].find();
208  HMType rez = ((Oper)_hm)._args[1].find();
209  return !fcn.eq(tnew) || !rez.eq(trez);
210  }

References com.cliffc.aa.HM.HM3.Lambda._arg0, com.cliffc.aa.HM.HM3.Syntax._hm, com.cliffc.aa.HM.HM3.Lambda.body(), com.cliffc.aa.HM.HM3.ENV, com.cliffc.aa.HM.HM3.HMType.eq(), and com.cliffc.aa.HM.HM3.HMType.find().

Referenced by com.cliffc.aa.HM.HM3.Lambda.hm().

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

◆ toString()

String com.cliffc.aa.HM.HM3.Lambda.toString ( )

Definition at line 193 of file HM3.java.

193 { return "{ "+_arg0+" -> "+body()+" }"; }

References com.cliffc.aa.HM.HM3.Lambda._arg0, and com.cliffc.aa.HM.HM3.Lambda.body().

Here is the call graph for this function:

Member Data Documentation

◆ _arg0

◆ _hm

◆ _kids

◆ _par

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

The documentation for this class was generated from the following file:
com.cliffc.aa.HM.HM3.Lambda._arg0
final String _arg0
Definition: HM3.java:190
com.cliffc.aa.HM.HM3.HMType.eq
final boolean eq(HMType v)
Definition: HM3.java:291
com.cliffc.aa.HM.HM3.Syntax.all_kids_ready
final boolean all_kids_ready()
Definition: HM3.java:135
com.cliffc.aa.HM.HM3.Syntax.progress
abstract boolean progress()
com.cliffc.aa.HM.HM3.HMType.find
abstract HMType find()
com.cliffc.aa.HM.HM3.Syntax._par
Syntax _par
Definition: HM3.java:116
com.cliffc.aa.HM.HM3.ENV
static final HashMap< String, HMType > ENV
Definition: HM3.java:32
com.cliffc.aa.HM.HM3.Syntax.add_work
final void add_work(Worklist work)
Definition: HM3.java:126
com.cliffc.aa.HM.HM3.Lambda.progress
boolean progress()
Definition: HM3.java:200
com.cliffc.aa.HM.HM3.Syntax.get_ids
abstract void get_ids(VStack vstk, Worklist work)
com.cliffc.aa.HM.HM3.Syntax._hm
HMType _hm
Definition: HM3.java:118
com.cliffc.aa.HM.HM3.Lambda.body
Syntax body()
Definition: HM3.java:192
com.cliffc.aa.HM.HM3.Syntax._kids
Syntax[] _kids
Definition: HM3.java:117