paul@17 | 1 | #!/usr/bin/env python |
paul@17 | 2 | |
paul@17 | 3 | """ |
paul@17 | 4 | RSVP instruction classes. |
paul@17 | 5 | |
paul@17 | 6 | Copyright (C) 2007 Paul Boddie <paul@boddie.org.uk> |
paul@17 | 7 | |
paul@17 | 8 | This program is free software; you can redistribute it and/or modify it under |
paul@17 | 9 | the terms of the GNU General Public License as published by the Free Software |
paul@17 | 10 | Foundation; either version 3 of the License, or (at your option) any later |
paul@17 | 11 | version. |
paul@17 | 12 | |
paul@17 | 13 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@17 | 14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@17 | 15 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@17 | 16 | details. |
paul@17 | 17 | |
paul@17 | 18 | You should have received a copy of the GNU General Public License along with |
paul@17 | 19 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@17 | 20 | """ |
paul@17 | 21 | |
paul@17 | 22 | class Instruction: |
paul@17 | 23 | |
paul@17 | 24 | "A generic instruction." |
paul@17 | 25 | |
paul@21 | 26 | def __init__(self, attr=None): |
paul@17 | 27 | self.attr = attr |
paul@17 | 28 | |
paul@17 | 29 | def __repr__(self): |
paul@17 | 30 | return "%s(%r)" % (self.__class__.__name__, self.attr) |
paul@17 | 31 | |
paul@21 | 32 | # Instructions operating on the value stack. |
paul@21 | 33 | |
paul@21 | 34 | class LoadConst(Instruction): pass |
paul@21 | 35 | |
paul@21 | 36 | # Access within an invocation frame. |
paul@21 | 37 | |
paul@17 | 38 | class LoadName(Instruction): pass |
paul@17 | 39 | class StoreName(Instruction): pass |
paul@21 | 40 | |
paul@21 | 41 | # Access to address-relative data. |
paul@21 | 42 | |
paul@21 | 43 | class MakeObject(Instruction): pass |
paul@21 | 44 | # ... DropObject not defined: assume garbage collection. |
paul@21 | 45 | class LoadAttr(Instruction): pass |
paul@17 | 46 | class StoreAttr(Instruction): pass |
paul@21 | 47 | |
paul@21 | 48 | # Access to invocation frames in preparation. |
paul@21 | 49 | |
paul@21 | 50 | class MakeFrame(Instruction): pass |
paul@21 | 51 | class DropFrame(Instruction): pass |
paul@21 | 52 | class StoreFrame(Instruction): pass |
paul@21 | 53 | |
paul@21 | 54 | # Invocation-related instructions. |
paul@21 | 55 | |
paul@19 | 56 | class Jump(Instruction): pass |
paul@21 | 57 | class LoadCallable(Instruction): pass |
paul@21 | 58 | class Return(Instruction): pass |
paul@17 | 59 | |
paul@17 | 60 | # vim: tabstop=4 expandtab shiftwidth=4 |