示例#1
0
        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
        }
示例#2
0
        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;
        }