public void TestSet() { var foo = new Id(new Word("foo", Tag.ID), Sara.Type.Int, 0x20); var bar = new Constant(55); var set = new Set(foo, bar); set.Gen(10, 20); //output: // foo = 55 }
public Stmt Assign() { Stmt stmt; var tok = _look; this.Match(Tag.ID); var id = Top.Get(tok); if (id == null) this.Error(tok.ToString() + " undeclared"); if(_look.TagValue == '=') { this.Move(); stmt = new Set(id, this.Bool()); } else { Access x = this.Offset(id); this.Match('='); stmt = new SetElem(x, this.Bool()); } this.Match(';'); return stmt; }