aa
com.cliffc.aa.HM.HM8.Ident Class Reference
Inheritance diagram for com.cliffc.aa.HM.HM8.Ident:
[legend]
Collaboration diagram for com.cliffc.aa.HM.HM8.Ident:
[legend]

Public Member Functions

String p ()
 
final String toString ()
 

Package Functions

 Ident (String name)
 
void add_work (Worklist work)
 
T2 debug_find ()
 
T2 find ()
 
boolean hm (Worklist work)
 
T2 lookup (String name)
 
boolean more_work (Worklist work)
 
final boolean more_work_impl (Worklist work)
 
final SB p0 (SB sb, VBitSet dups)
 
SB p1 (SB sb)
 
SB p2 (SB sb, VBitSet dups)
 
T2 post ()
 
T2 pre ()
 
void prep_lookup_deps (Ident id)
 
int prep_tree (Syntax par, VStack nongen, Worklist work)
 
final void prep_tree_impl (Syntax par, VStack nongen, Worklist work, T2 t)
 
SB str (SB sb)
 

Package Attributes

final String _name
 
VStack _nongen
 
Syntax _par
 
T2 _post
 
T2 _pre
 
T2 _t
 

Detailed Description

Definition at line 319 of file HM8.java.

Constructor & Destructor Documentation

◆ Ident()

com.cliffc.aa.HM.HM8.Ident.Ident ( String  name)
package

Definition at line 321 of file HM8.java.

321 { _name=name; }

References com.cliffc.aa.HM.HM8.Ident._name.

Member Function Documentation

◆ add_work()

void com.cliffc.aa.HM.HM8.Ident.add_work ( Worklist  work)
package

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

Definition at line 338 of file HM8.java.

338  {
339  work.push(_par);
340  T2 t = _par==null ? null : _par.lookup(_name); // Lookup in current env
341  if( t==null ) t = PRIMS.get(_name); // Lookup in prims
342  t = t.find();
343  if( t.occurs_in(_par) ) // Got captured in some parent?
344  t.add_deps_work(work); // Need to revisit dependent ids
345  }

References com.cliffc.aa.HM.HM8.Ident._name, com.cliffc.aa.HM.HM8.Syntax._par, com.cliffc.aa.HM.HM8.T2.add_deps_work(), com.cliffc.aa.HM.HM8.T2.find(), com.cliffc.aa.HM.HM8.Syntax.lookup(), com.cliffc.aa.HM.HM8.T2.occurs_in(), com.cliffc.aa.HM.HM8.PRIMS, and com.cliffc.aa.HM.HM8.Worklist.push().

Here is the call graph for this function:

◆ debug_find()

T2 com.cliffc.aa.HM.HM8.Syntax.debug_find ( )
packageinherited

Definition at line 249 of file HM8.java.

249 { return _t.debug_find(); } // Find, without the roll-up

References com.cliffc.aa.HM.HM8.Syntax._t, and com.cliffc.aa.HM.HM8.T2.debug_find().

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

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

◆ find()

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

Definition at line 245 of file HM8.java.

245  { // U-F find
246  T2 t = _t.find();
247  return t==_t ? t : (_t=t);
248  }

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

Referenced by com.cliffc.aa.HM.HM8.T2._occurs_in(), com.cliffc.aa.HM.HM8.Lambda.add_work(), com.cliffc.aa.HM.HM8.Let.add_work(), com.cliffc.aa.HM.HM8.Ident.hm(), com.cliffc.aa.HM.HM8.Lambda.hm(), com.cliffc.aa.HM.HM8.Let.hm(), com.cliffc.aa.HM.HM8.Apply.hm(), com.cliffc.aa.HM.HM8.Struct.hm(), com.cliffc.aa.HM.HM8.Field.hm(), com.cliffc.aa.HM.HM8.Apply.is_if_nil(), and com.cliffc.aa.HM.HM8.Struct.prep_tree().

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

◆ hm()

boolean com.cliffc.aa.HM.HM8.Ident.hm ( Worklist  work)
package

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

Definition at line 325 of file HM8.java.

325  {
326  // A boolean if name is from a Let._body (or PRIM) vs Let._def (or
327  // Lambda). Not helpful, as its only useful at the top-layer.
328  // Structural unification requires the 'occurs check' at each internal
329  // layer, which can differ from the top-layer.
330  //boolean occurs_fresh = _par==null /*from prims*/ || _par.is_fresh(_name,this);
331  T2 t = _par==null ? null : _par.lookup(_name); // Lookup in current env
332  if( t==null ) t = PRIMS.get(_name); // Lookup in prims
333  if( t==null )
334  throw new RuntimeException("Parse error, "+_name+" is undefined");
335  return t.find().fresh_unify(find(),_nongen,work);
336  }

References com.cliffc.aa.HM.HM8.Ident._name, com.cliffc.aa.HM.HM8.Syntax._nongen, com.cliffc.aa.HM.HM8.Syntax._par, com.cliffc.aa.HM.HM8.Syntax.find(), com.cliffc.aa.HM.HM8.T2.find(), com.cliffc.aa.HM.HM8.T2.fresh_unify(), com.cliffc.aa.HM.HM8.Syntax.lookup(), and com.cliffc.aa.HM.HM8.PRIMS.

Here is the call graph for this function:

◆ lookup()

T2 com.cliffc.aa.HM.HM8.Ident.lookup ( String  name)
package

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

Definition at line 337 of file HM8.java.

337 { throw unimpl("should not reach here"); }

◆ more_work()

boolean com.cliffc.aa.HM.HM8.Ident.more_work ( Worklist  work)
package

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

Definition at line 354 of file HM8.java.

354 { return more_work_impl(work); }

References com.cliffc.aa.HM.HM8.Syntax.more_work_impl().

Here is the call graph for this function:

◆ more_work_impl()

final boolean com.cliffc.aa.HM.HM8.Syntax.more_work_impl ( Worklist  work)
packageinherited

Definition at line 283 of file HM8.java.

283  {
284  boolean no_more_work = work.has(this) || !hm(null); // Either on worklist, or no-progress
285  return no_more_work;
286  }

References com.cliffc.aa.HM.HM8.Worklist.has(), and com.cliffc.aa.HM.HM8.Syntax.hm().

Referenced by com.cliffc.aa.HM.HM8.Con.more_work(), com.cliffc.aa.HM.HM8.Ident.more_work(), com.cliffc.aa.HM.HM8.Lambda.more_work(), com.cliffc.aa.HM.HM8.Let.more_work(), com.cliffc.aa.HM.HM8.Apply.more_work(), com.cliffc.aa.HM.HM8.Struct.more_work(), and com.cliffc.aa.HM.HM8.Field.more_work().

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

◆ p()

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

Definition at line 291 of file HM8.java.

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

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

Here is the call graph for this function:

◆ p0()

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

Definition at line 292 of file HM8.java.

292  {
293  _t.get_dups(dups);
294  _t.str(p1(sb.i()).p(" "), new VBitSet(),dups).nl();
295  return p2(sb.ii(1),dups).di(1);
296  }

References com.cliffc.aa.HM.HM8.Syntax._t, com.cliffc.aa.util.SB.di(), com.cliffc.aa.HM.HM8.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.HM8.Syntax.p1(), com.cliffc.aa.HM.HM8.Syntax.p2(), and com.cliffc.aa.HM.HM8.T2.str().

Referenced by com.cliffc.aa.HM.HM8.Syntax.p(), com.cliffc.aa.HM.HM8.Lambda.p2(), com.cliffc.aa.HM.HM8.Let.p2(), com.cliffc.aa.HM.HM8.Apply.p2(), com.cliffc.aa.HM.HM8.Struct.p2(), and com.cliffc.aa.HM.HM8.Field.p2().

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

◆ p1()

SB com.cliffc.aa.HM.HM8.Ident.p1 ( SB  sb)
package

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

Definition at line 323 of file HM8.java.

323 { return sb.p(_name); }

References com.cliffc.aa.HM.HM8.Ident._name, and com.cliffc.aa.util.SB.p().

Referenced by com.cliffc.aa.HM.HM8.Ident.str().

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

◆ p2()

SB com.cliffc.aa.HM.HM8.Ident.p2 ( SB  sb,
VBitSet  dups 
)
package

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

Definition at line 324 of file HM8.java.

324 { return sb; }

◆ post()

T2 com.cliffc.aa.HM.HM8.Syntax.post ( )
packageinherited

Definition at line 254 of file HM8.java.

254  {
255  T2 t = _post.find();
256  return t==_post ? t : (_post=t);
257  }

References com.cliffc.aa.HM.HM8.Syntax._post, and com.cliffc.aa.HM.HM8.T2.find().

Referenced by com.cliffc.aa.HM.HM8.Lambda.hm(), com.cliffc.aa.HM.HM8.Let.hm(), com.cliffc.aa.HM.HM8.Apply.hm(), com.cliffc.aa.HM.HM8.Struct.hm(), and com.cliffc.aa.HM.HM8.Field.hm().

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

◆ pre()

T2 com.cliffc.aa.HM.HM8.Syntax.pre ( )
packageinherited

Definition at line 250 of file HM8.java.

250  {
251  T2 t = _pre.find();
252  return t==_pre ? t : (_pre=t);
253  }

References com.cliffc.aa.HM.HM8.Syntax._pre, and com.cliffc.aa.HM.HM8.T2.find().

Referenced by com.cliffc.aa.HM.HM8.Lambda.hm(), com.cliffc.aa.HM.HM8.Let.hm(), com.cliffc.aa.HM.HM8.Apply.hm(), com.cliffc.aa.HM.HM8.Struct.hm(), and com.cliffc.aa.HM.HM8.Field.hm().

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

◆ prep_lookup_deps()

void com.cliffc.aa.HM.HM8.Ident.prep_lookup_deps ( Ident  id)
package

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

Definition at line 353 of file HM8.java.

353 { throw unimpl("should not reach here"); }

◆ prep_tree()

int com.cliffc.aa.HM.HM8.Ident.prep_tree ( Syntax  par,
VStack  nongen,
Worklist  work 
)
package

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

Definition at line 346 of file HM8.java.

346  {
347  prep_tree_impl(par,nongen,work,T2.make_leaf());
348  _pre=_post; // Unify at prep-time
349  for( Syntax syn = _par; syn!=null; syn = syn._par )
350  syn.prep_lookup_deps(this);
351  return 1;
352  }

References com.cliffc.aa.HM.HM8.Syntax._par, com.cliffc.aa.HM.HM8.Syntax._post, com.cliffc.aa.HM.HM8.Syntax._pre, com.cliffc.aa.HM.HM8.T2.make_leaf(), and com.cliffc.aa.HM.HM8.Syntax.prep_tree_impl().

Here is the call graph for this function:

◆ prep_tree_impl()

final void com.cliffc.aa.HM.HM8.Syntax.prep_tree_impl ( Syntax  par,
VStack  nongen,
Worklist  work,
T2  t 
)
packageinherited

Definition at line 267 of file HM8.java.

267  {
268  _par=par;
269  _pre = T2.make_mem();
270  _t=t;
271  _post = T2.make_mem();
272  _nongen = nongen;
273  work.push(this);
274  }

References com.cliffc.aa.HM.HM8.Syntax._nongen, com.cliffc.aa.HM.HM8.Syntax._par, com.cliffc.aa.HM.HM8.Syntax._post, com.cliffc.aa.HM.HM8.Syntax._pre, com.cliffc.aa.HM.HM8.Syntax._t, com.cliffc.aa.HM.HM8.T2.make_mem(), and com.cliffc.aa.HM.HM8.Worklist.push().

Referenced by com.cliffc.aa.HM.HM8.Con.prep_tree(), com.cliffc.aa.HM.HM8.Ident.prep_tree(), com.cliffc.aa.HM.HM8.Lambda.prep_tree(), com.cliffc.aa.HM.HM8.Let.prep_tree(), com.cliffc.aa.HM.HM8.Apply.prep_tree(), com.cliffc.aa.HM.HM8.Struct.prep_tree(), and com.cliffc.aa.HM.HM8.Field.prep_tree().

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

◆ str()

SB com.cliffc.aa.HM.HM8.Ident.str ( SB  sb)
package

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

Definition at line 322 of file HM8.java.

322 { return p1(sb); }

References com.cliffc.aa.HM.HM8.Ident.p1().

Here is the call graph for this function:

◆ toString()

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

Definition at line 288 of file HM8.java.

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

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

Here is the call graph for this function:

Member Data Documentation

◆ _name

final String com.cliffc.aa.HM.HM8.Ident._name
package

◆ _nongen

VStack com.cliffc.aa.HM.HM8.Syntax._nongen
packageinherited

◆ _par

◆ _post

◆ _pre

◆ _t


The documentation for this class was generated from the following file:
com.cliffc.aa.HM.HM8.Syntax.hm
abstract boolean hm(Worklist work)
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.HM8.Syntax._par
Syntax _par
Definition: HM8.java:240
com.cliffc.aa.HM.HM8.T2.get_dups
VBitSet get_dups(VBitSet dups)
Definition: HM8.java:1196
com.cliffc.aa.HM.HM8.T2.make_mem
static T2 make_mem()
Definition: HM8.java:751
com.cliffc.aa.HM.HM8.Syntax._nongen
VStack _nongen
Definition: HM8.java:241
com.cliffc.aa.HM.HM8.T2.debug_find
T2 debug_find()
Definition: HM8.java:777
com.cliffc.aa.HM.HM8.Syntax._pre
T2 _pre
Definition: HM8.java:242
com.cliffc.aa.HM.HM8.Syntax.lookup
abstract T2 lookup(String name)
com.cliffc.aa.HM.HM8.Syntax._post
T2 _post
Definition: HM8.java:244
com.cliffc.aa.HM.HM8.T2.str
SB str(SB sb, VBitSet visit, VBitSet dups)
Definition: HM8.java:1209
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.HM.HM8.Syntax.p2
abstract SB p2(SB sb, VBitSet dups)
com.cliffc.aa.HM.HM8.Syntax.p1
abstract SB p1(SB sb)
com.cliffc.aa.HM.HM8.Syntax.prep_tree_impl
final void prep_tree_impl(Syntax par, VStack nongen, Worklist work, T2 t)
Definition: HM8.java:267
com.cliffc.aa.util.SB.nl
SB nl()
Definition: SB.java:48
com.cliffc.aa.HM.HM8.Syntax._t
T2 _t
Definition: HM8.java:243
com.cliffc.aa.util.SB.p
SB p(String s)
Definition: SB.java:13
com.cliffc.aa.HM.HM8.Syntax.p0
final SB p0(SB sb, VBitSet dups)
Definition: HM8.java:292
com.cliffc.aa.HM.HM8.Syntax.str
abstract SB str(SB sb)
com.cliffc.aa.HM.HM8.Syntax.find
T2 find()
Definition: HM8.java:245
com.cliffc.aa.HM.HM8.Ident._name
final String _name
Definition: HM8.java:320
com.cliffc.aa.HM.HM8.Ident.p1
SB p1(SB sb)
Definition: HM8.java:323
com.cliffc.aa.util.SB.i
SB i(int d)
Definition: SB.java:38
com.cliffc.aa.HM.HM8.T2.find
T2 find()
Definition: HM8.java:788
com.cliffc.aa.HM.HM8.PRIMS
static final HashMap< String, T2 > PRIMS
Definition: HM8.java:25
com.cliffc.aa.HM.HM8.Syntax.more_work_impl
final boolean more_work_impl(Worklist work)
Definition: HM8.java:283
com.cliffc.aa.util.SB.toString
String toString()
Definition: SB.java:62