wisp-cvs Mailing List for Wisp interpreter (Page 14)
Status: Alpha
Brought to you by:
digg
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(30) |
Sep
(312) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(5) |
Feb
(131) |
Mar
(17) |
Apr
(184) |
May
(252) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
From: <di...@us...> - 2003-04-22 15:02:16
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv4657 Modified Files: tran.py Log Message: minor cleanup Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- tran.py 22 Apr 2003 14:51:25 -0000 1.47 +++ tran.py 22 Apr 2003 15:02:12 -0000 1.48 @@ -239,8 +239,6 @@ def reserve (n): cursect.skip(n) def minor (reg): Regstack.append(Integer_Literal(reg[-1])) -def swap (x, y): - Regstack.append(y); Regstack.append(x) def dup (x): Regstack.append(x); Regstack.append(x) def colon_macro (name): @@ -401,7 +399,6 @@ 'reg': ('simple', Generic_Register), 'reserve int': ('builtin', reserve, 1), 'sum': ('simple', Class_Marker('sum')), - 'swap any any': ('builtin', swap, 2), 'sym': ('simple', Class_Marker('sym')), } @@ -440,11 +437,15 @@ .text cursect = Text +// + Regstack = [] + drop any Regstack.pop() -// - Regstack = [] +swap any any + y = Regstack.pop(); x = Regstack.pop() + Regstack.append(y); Regstack.append(x) ''' for b in BUILTINS.split('\n\n'): |
From: <di...@us...> - 2003-04-22 14:51:30
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv32297 Modified Files: tran.py Log Message: introduced clearer syntax for builtin definition Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- tran.py 22 Apr 2003 14:32:30 -0000 1.46 +++ tran.py 22 Apr 2003 14:51:25 -0000 1.47 @@ -270,9 +270,6 @@ if not isinstance(a, Constant_Sum): a = Constant_Sum(a) if not isinstance(b, Constant_Sum): b = Constant_Sum(b) Regstack.append(a - b) -def clear (): - global Regstack - Regstack = [] def matchers (object): if isinstance(object, Class_Marker): @@ -389,7 +386,6 @@ Meaning = { '+ const const': ('builtin', plus, 2), '- const const': ('builtin', minus, 2), - '//': ('builtin', clear, 0), ':macro': ('builtin', colon_macro, 0 | MA_PREFIX), ':regs': ('builtin', colon_regs, 0 | MA_PREFIX), 'align int': ('builtin', align, 1), @@ -429,19 +425,33 @@ cursect.emit_tetra_sum([str(n)], relative = 1) Meaning['$-t, sym'] = 'builtin', dollar_minus_tetra_comma_sym, 1 -# Sections -def dot_bss (): global cursect; cursect = Bss -Meaning['.bss'] = 'builtin', dot_bss, 0 -def dot_data (): global cursect; cursect = Data -Meaning['.data'] = 'builtin', dot_data, 0 -def dot_text (): global cursect; cursect = Text -Meaning['.text'] = 'builtin', dot_text, 0 - -# Stack def drop_any (): Regstack.pop() Meaning['drop any'] = 'builtin', drop_any, 0 # End of builtins +BUILTINS = ''' + +.bss + cursect = Bss + +.data + cursect = Data + +.text + cursect = Text + +drop any + Regstack.pop() + +// + Regstack = [] +''' + +for b in BUILTINS.split('\n\n'): + if b: + name, code = b.split('\n', 1) + exec 'def _primitive ():\n global cursect, Regstack\n' + code + '\n' + Meaning[name] = 'builtin', _primitive, 0 current_recordee = None current_register_family = 0 |
From: <di...@us...> - 2003-04-22 14:32:37
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv22628 Modified Files: tran.py Log Message: minor cleanup Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- tran.py 22 Apr 2003 14:01:10 -0000 1.45 +++ tran.py 22 Apr 2003 14:32:30 -0000 1.46 @@ -438,7 +438,8 @@ Meaning['.text'] = 'builtin', dot_text, 0 # Stack -Meaning['drop any'] = 'builtin', (lambda x: None), 1 +def drop_any (): Regstack.pop() +Meaning['drop any'] = 'builtin', drop_any, 0 # End of builtins |
From: <di...@us...> - 2003-04-22 14:01:15
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv6648 Modified Files: tran.py Log Message: minor cleanup Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- tran.py 22 Apr 2003 13:57:33 -0000 1.44 +++ tran.py 22 Apr 2003 14:01:10 -0000 1.45 @@ -9,6 +9,7 @@ #### @(#) $Id$ from __future__ import generators +from __future__ import nested_scopes from getopt import getopt from linkie import Linkie @@ -232,15 +233,6 @@ def label (name): cursect.place_symbol('&' + name) -def dot_bss (): - global cursect - cursect = Bss -def dot_data (): - global cursect - cursect = Data -def dot_text (): - global cursect - cursect = Text def ref (name): Regstack.append(Symbol_Literal('&' + name)) def align (n): cursect.align(n) @@ -397,9 +389,6 @@ Meaning = { '+ const const': ('builtin', plus, 2), '- const const': ('builtin', minus, 2), - '.bss': ('builtin', dot_bss, 0), - '.data': ('builtin', dot_data, 0), - '.text': ('builtin', dot_text, 0), '//': ('builtin', clear, 0), ':macro': ('builtin', colon_macro, 0 | MA_PREFIX), ':regs': ('builtin', colon_regs, 0 | MA_PREFIX), @@ -439,6 +428,14 @@ def dollar_minus_tetra_comma_sym (n): cursect.emit_tetra_sum([str(n)], relative = 1) Meaning['$-t, sym'] = 'builtin', dollar_minus_tetra_comma_sym, 1 + +# Sections +def dot_bss (): global cursect; cursect = Bss +Meaning['.bss'] = 'builtin', dot_bss, 0 +def dot_data (): global cursect; cursect = Data +Meaning['.data'] = 'builtin', dot_data, 0 +def dot_text (): global cursect; cursect = Text +Meaning['.text'] = 'builtin', dot_text, 0 # Stack Meaning['drop any'] = 'builtin', (lambda x: None), 1 |
From: <di...@us...> - 2003-04-22 13:57:37
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv4837 Modified Files: tran.py Log Message: minor cleanup Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- tran.py 22 Apr 2003 13:54:16 -0000 1.43 +++ tran.py 22 Apr 2003 13:57:33 -0000 1.44 @@ -243,7 +243,6 @@ cursect = Text def ref (name): Regstack.append(Symbol_Literal('&' + name)) -def drop (x): pass def align (n): cursect.align(n) def reserve (n): cursect.skip(n) def minor (reg): @@ -407,7 +406,6 @@ 'align int': ('builtin', align, 1), 'any': ('simple', Class_Marker('any')), 'const': ('simple', Class_Marker('const')), - 'drop any': ('builtin', drop, 1), 'dup any': ('builtin', dup, 1), 'include': ('include',), 'int': ('simple', Class_Marker('int')), @@ -441,6 +439,11 @@ def dollar_minus_tetra_comma_sym (n): cursect.emit_tetra_sum([str(n)], relative = 1) Meaning['$-t, sym'] = 'builtin', dollar_minus_tetra_comma_sym, 1 + +# Stack +Meaning['drop any'] = 'builtin', (lambda x: None), 1 + +# End of builtins current_recordee = None current_register_family = 0 |
From: <di...@us...> - 2003-04-22 13:54:20
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv3187 Modified Files: tran.py Log Message: implemented --show-words Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- tran.py 22 Apr 2003 13:45:13 -0000 1.42 +++ tran.py 22 Apr 2003 13:54:16 -0000 1.43 @@ -455,13 +455,25 @@ def main (): global prep - opts, args = getopt(sys.argv[1:], 'o:', ['output=']) - if len(args) != 1: - raise 'Invalid argument count -- must be 1', args - prep = Preprocessor(args[0]) + opts, args = getopt(sys.argv[1:], 'o:', ['output=', 'show-words']) output_name = 'a.out' + show_words = 0 for opt, arg in opts: if opt in ('-o', '--output'): output_name = arg + if opt == '--show-words': show_words = 1 + if show_words: + wd = {} + for w in Meaning.keys(): + s = w.find(' ') + if s != -1: w = w[:s] + wd[w] = 1 + w = wd.keys() + w.sort() + print 'Internally known words:' + print ' ', ' '.join(w) + if len(args) != 1: + raise 'Invalid argument count -- must be 1', args + prep = Preprocessor(args[0]) mainloop() print 'TEXT'; Text.dump() print 'DATA'; Data.dump() |
From: <di...@us...> - 2003-04-22 13:45:19
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv30761 Modified Files: tran.py Log Message: minor cleanup Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- tran.py 22 Apr 2003 13:21:47 -0000 1.41 +++ tran.py 22 Apr 2003 13:45:13 -0000 1.42 @@ -230,22 +230,6 @@ res += '- ' + `-this.scalar` return res -def b_comma (n): - if isinstance(n, Integer_Literal): cursect.emit_byte(long(n) % 0x100) - elif isinstance(n, Symbol_Literal): cursect.emit_byte_sum([str(n)]) - else: raise 'Literal expected', n -def w_comma (n): - if isinstance(n, Integer_Literal): cursect.emit_wyde(long(n) % 0x10000) - elif isinstance(n, Symbol_Literal): cursect.emit_wyde_sum([str(n)]) - else: raise 'Literal expected', n -def t_comma (n): - if isinstance(n, Integer_Literal): cursect.emit_tetra(long(n) % 0x100000000L) - elif isinstance(n, Symbol_Literal): cursect.emit_tetra_sum([str(n)]) - else: raise 'Literal expected', n -def dollar_minus_tetra_comma (n): - if isinstance(n, Symbol_Literal): - cursect.emit_tetra_sum([str(n)], relative = 1) - else: raise 'Symbol expected', n def label (name): cursect.place_symbol('&' + name) def dot_bss (): @@ -412,7 +396,6 @@ MA_ARGC = 007 MA_PREFIX = 010 Meaning = { - '$-t, sym': ('builtin', dollar_minus_tetra_comma, 1), '+ const const': ('builtin', plus, 2), '- const const': ('builtin', minus, 2), '.bss': ('builtin', dot_bss, 0), @@ -423,7 +406,6 @@ ':regs': ('builtin', colon_regs, 0 | MA_PREFIX), 'align int': ('builtin', align, 1), 'any': ('simple', Class_Marker('any')), - 'b, lit': ('builtin', b_comma, 1), 'const': ('simple', Class_Marker('const')), 'drop any': ('builtin', drop, 1), 'dup any': ('builtin', dup, 1), @@ -438,9 +420,28 @@ 'sum': ('simple', Class_Marker('sum')), 'swap any any': ('builtin', swap, 2), 'sym': ('simple', Class_Marker('sym')), - 't, lit': ('builtin', t_comma, 1), - 'w, lit': ('builtin', w_comma, 1), } + +# Emitters +def byte_comma_int (n): cursect.emit_byte(long(n) % 0x100L) +Meaning['b, int'] = 'builtin', byte_comma_int, 1 +def byte_comma_sym (a): cursect.emit_byte_sum([str(a)]) +Meaning['b, sym'] = 'builtin', byte_comma_sym, 1 + +def wyde_comma_int (n): cursect.emit_wyde(long(n) % 0x10000L) +Meaning['w, int'] = 'builtin', wyde_comma_int, 1 +def wyde_comma_sym (a): cursect.emit_wyde_sum([str(a)]) +Meaning['w, sym'] = 'builtin', wyde_comma_sym, 1 + +def tetra_comma_int (n): cursect.emit_tetra(long(n) % 0x100000000L) +Meaning['t, int'] = 'builtin', tetra_comma_int, 1 +def tetra_comma_sym (a): cursect.emit_tetra_sum([str(a)]) +Meaning['t, sym'] = 'builtin', tetra_comma_sym, 1 + +def dollar_minus_tetra_comma_sym (n): + cursect.emit_tetra_sum([str(n)], relative = 1) +Meaning['$-t, sym'] = 'builtin', dollar_minus_tetra_comma_sym, 1 + current_recordee = None current_register_family = 0 State = state_outer |
From: <di...@us...> - 2003-04-22 13:22:24
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv21864 Modified Files: mswhello.tran Log Message: substituted "4 - $-t," for "$ - 4 - t," Index: mswhello.tran =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/mswhello.tran,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- mswhello.tran 17 Apr 2003 11:50:34 -0000 1.4 +++ mswhello.tran 22 Apr 2003 13:22:21 -0000 1.5 @@ -10,7 +10,7 @@ include ia32 -lit :macro $call #xe8 b, $ - 4 - t, ; +lit :macro $call #xe8 b, 4 - $-t, ; \ main entry point |
From: <di...@us...> - 2003-04-22 13:21:50
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv21675 Modified Files: tran.py Log Message: dropped the $ word Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- tran.py 22 Apr 2003 13:17:37 -0000 1.40 +++ tran.py 22 Apr 2003 13:21:47 -0000 1.41 @@ -412,7 +412,6 @@ MA_ARGC = 007 MA_PREFIX = 010 Meaning = { - '$': ('simple', Dollar), '$-t, sym': ('builtin', dollar_minus_tetra_comma, 1), '+ const const': ('builtin', plus, 2), '- const const': ('builtin', minus, 2), |
From: <di...@us...> - 2003-04-22 13:17:41
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv20276 Modified Files: tran.py Log Message: added the $-t, word Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- tran.py 22 Apr 2003 12:46:58 -0000 1.39 +++ tran.py 22 Apr 2003 13:17:37 -0000 1.40 @@ -242,6 +242,10 @@ if isinstance(n, Integer_Literal): cursect.emit_tetra(long(n) % 0x100000000L) elif isinstance(n, Symbol_Literal): cursect.emit_tetra_sum([str(n)]) else: raise 'Literal expected', n +def dollar_minus_tetra_comma (n): + if isinstance(n, Symbol_Literal): + cursect.emit_tetra_sum([str(n)], relative = 1) + else: raise 'Symbol expected', n def label (name): cursect.place_symbol('&' + name) def dot_bss (): @@ -409,6 +413,7 @@ MA_PREFIX = 010 Meaning = { '$': ('simple', Dollar), + '$-t, sym': ('builtin', dollar_minus_tetra_comma, 1), '+ const const': ('builtin', plus, 2), '- const const': ('builtin', minus, 2), '.bss': ('builtin', dot_bss, 0), |
From: <di...@us...> - 2003-04-22 12:47:04
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv8477 Modified Files: ia32.tran tran.py Log Message: added the // word Index: ia32.tran =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/ia32.tran,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ia32.tran 16 Apr 2003 08:02:47 -0000 1.2 +++ ia32.tran 22 Apr 2003 12:46:57 -0000 1.3 @@ -11,6 +11,6 @@ :regs reg16 %ax %cx %dx %bx %sp %bp %si %di ; :regs reg8 %al %cl %dl %bl %ah %ch %dh %bh ; -lit :macro $int #xCD b, b, ; -reg32 lit :macro $mov swap minor #o270 + b, t, ; -lit :macro $push #x68 b, t, ; +// lit :macro $int #xCD b, b, ; +// reg32 lit :macro $mov swap minor #o270 + b, t, ; +// lit :macro $push #x68 b, t, ; Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- tran.py 22 Apr 2003 12:36:54 -0000 1.38 +++ tran.py 22 Apr 2003 12:46:58 -0000 1.39 @@ -291,6 +291,9 @@ if not isinstance(a, Constant_Sum): a = Constant_Sum(a) if not isinstance(b, Constant_Sum): b = Constant_Sum(b) Regstack.append(a - b) +def clear (): + global Regstack + Regstack = [] def matchers (object): if isinstance(object, Class_Marker): @@ -411,6 +414,7 @@ '.bss': ('builtin', dot_bss, 0), '.data': ('builtin', dot_data, 0), '.text': ('builtin', dot_text, 0), + '//': ('builtin', clear, 0), ':macro': ('builtin', colon_macro, 0 | MA_PREFIX), ':regs': ('builtin', colon_regs, 0 | MA_PREFIX), 'align int': ('builtin', align, 1), |
From: <di...@us...> - 2003-04-22 12:36:59
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv4324 Modified Files: tran.py Log Message: let Register inherit from Stackable Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- tran.py 22 Apr 2003 12:32:12 -0000 1.37 +++ tran.py 22 Apr 2003 12:36:54 -0000 1.38 @@ -24,7 +24,7 @@ def get_scalar (this): return 0 def get_dollars (this): return 0 def get_symbols (this): return () - def get_regs (this): return () + def get_registers (this): return () class Token (object): pass class Stackable (object): def contained_registers (this): @@ -67,8 +67,6 @@ class Dollar_Type (Unique, Stackable, Summable): def __init__ (this): Unique.__init__(this, '$') - Stackable.__init__(this) - Summable.__init__(this) def get_dollars (this): return 1 Semicolon = Unique_Token(';') @@ -176,7 +174,7 @@ if tok <> None: return tok else: return Lexer.get_token(this) -class Register (tuple): +class Register (tuple, Stackable): def __new__ (cls, *args): return tuple.__new__(cls, args) def parent (this): @@ -189,6 +187,8 @@ i += 1 def __repr__ (this): return 'Register' + tuple.__repr__(this) + def contained_registers (this): + return this, class Class_Marker (object): def __init__ (this, id): |
From: <di...@us...> - 2003-04-22 12:32:17
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv2109 Modified Files: tran.py Log Message: dropped subtractees from Summable:s Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- tran.py 22 Apr 2003 11:35:47 -0000 1.36 +++ tran.py 22 Apr 2003 12:32:12 -0000 1.37 @@ -23,11 +23,8 @@ class Summable (object): def get_scalar (this): return 0 def get_dollars (this): return 0 - def get_pos_symbols (this): return () - def get_neg_symbols (this): return () - def get_pos_regs (this): return () - def get_neg_regs (this): return () - + def get_symbols (this): return () + def get_regs (this): return () class Token (object): pass class Stackable (object): def contained_registers (this): @@ -56,7 +53,7 @@ if not isinstance(this, Constant_Sum): this = Constant_Sum(this) if not isinstance(that, Constant_Sum): that = Constant_Sum(that) return this - that - def get_pos_symbols (this): + def get_symbols (this): return this, class Unique (object): |
From: <di...@us...> - 2003-04-22 11:35:51
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv11018 Modified Files: tran.py Log Message: replaced Unique_Stackable by Dollar_Type inheriting from Summable Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- tran.py 22 Apr 2003 10:36:45 -0000 1.35 +++ tran.py 22 Apr 2003 11:35:47 -0000 1.36 @@ -67,10 +67,15 @@ def __str__ (this): return this.name class Unique_Token (Unique, Token): pass -class Unique_Stackable (Unique, Stackable): pass +class Dollar_Type (Unique, Stackable, Summable): + def __init__ (this): + Unique.__init__(this, '$') + Stackable.__init__(this) + Summable.__init__(this) + def get_dollars (this): return 1 Semicolon = Unique_Token(';') -Dollar = Unique_Stackable('$') +Dollar = Dollar_Type() class Constant_Sum (Stackable): def __init__ (this, plus = (), minus = (), scalar = 0L): |
From: <di...@us...> - 2003-04-22 10:36:51
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv20670 Modified Files: tran.py Log Message: let Symbol_Literal inherit from Summable Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- tran.py 22 Apr 2003 10:24:03 -0000 1.34 +++ tran.py 22 Apr 2003 10:36:45 -0000 1.35 @@ -43,7 +43,7 @@ return 'Integer_Literal(%i)' % long(this) def get_scalar (this): return long(this) -class Symbol_Literal (str, Stackable): +class Symbol_Literal (str, Stackable, Summable): def __new__ (cls, s): return str.__new__(cls, s) def __repr__ (this): @@ -56,6 +56,8 @@ if not isinstance(this, Constant_Sum): this = Constant_Sum(this) if not isinstance(that, Constant_Sum): that = Constant_Sum(that) return this - that + def get_pos_symbols (this): + return this, class Unique (object): def __init__ (this, name): |
From: <di...@us...> - 2003-04-22 10:24:07
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv15923 Modified Files: tran.py Log Message: let Integer_Literal inherit from Summable Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- tran.py 22 Apr 2003 10:22:21 -0000 1.33 +++ tran.py 22 Apr 2003 10:24:03 -0000 1.34 @@ -32,7 +32,7 @@ class Stackable (object): def contained_registers (this): return () -class Integer_Literal (long, Stackable, Token): +class Integer_Literal (long, Stackable, Token, Summable): def __new__ (cls, i): return long.__new__(cls, i) def __add__ (this, that): @@ -41,6 +41,8 @@ return Integer_Literal(long(this) - long(that)) def __repr__ (this): return 'Integer_Literal(%i)' % long(this) + def get_scalar (this): + return long(this) class Symbol_Literal (str, Stackable): def __new__ (cls, s): return str.__new__(cls, s) |
From: <di...@us...> - 2003-04-22 10:22:26
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv15105 Modified Files: tran.py Log Message: introduced the Summable interface class Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- tran.py 22 Apr 2003 07:53:01 -0000 1.32 +++ tran.py 22 Apr 2003 10:22:21 -0000 1.33 @@ -20,6 +20,14 @@ def abstract (this, *arg, **narg): raise 'abstract method was called', this +class Summable (object): + def get_scalar (this): return 0 + def get_dollars (this): return 0 + def get_pos_symbols (this): return () + def get_neg_symbols (this): return () + def get_pos_regs (this): return () + def get_neg_regs (this): return () + class Token (object): pass class Stackable (object): def contained_registers (this): |
From: <di...@us...> - 2003-04-22 07:53:06
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv9205 Modified Files: tran.py Log Message: let Token, Stackable, Unique, Macro_Cursor, and Class_Marker inherit from object Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- tran.py 21 Apr 2003 09:30:56 -0000 1.31 +++ tran.py 22 Apr 2003 07:53:01 -0000 1.32 @@ -20,8 +20,8 @@ def abstract (this, *arg, **narg): raise 'abstract method was called', this -class Token: pass -class Stackable: +class Token (object): pass +class Stackable (object): def contained_registers (this): return () class Integer_Literal (long, Stackable, Token): @@ -47,7 +47,7 @@ if not isinstance(that, Constant_Sum): that = Constant_Sum(that) return this - that -class Unique: +class Unique (object): def __init__ (this, name): this.name = name def __repr__ (this): @@ -138,7 +138,7 @@ def push_file (this, filename): this.push_source(open(filename, 'r'), filename) -class Macro_Cursor: +class Macro_Cursor (object): def __init__ (this, sequence): this.sequence = sequence this.current = 0 @@ -176,7 +176,7 @@ def __repr__ (this): return 'Register' + tuple.__repr__(this) -class Class_Marker: +class Class_Marker (object): def __init__ (this, id): this.id = id |
From: <di...@us...> - 2003-04-22 07:04:24
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv12669 Modified Files: linkie.py Log Message: let Linkie inherit from object Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- linkie.py 21 Apr 2003 11:37:16 -0000 1.32 +++ linkie.py 22 Apr 2003 07:04:20 -0000 1.33 @@ -10,7 +10,7 @@ from array import array from types import * -class Linkie: +class Linkie (object): def __init__ (this, byte_order): this._symbols = [] # symbol -> address this._alignment = 1 # minimal required alignment constraint |
From: <di...@us...> - 2003-04-21 11:37:20
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv1389 Modified Files: linkie.py Log Message: minor fix Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- linkie.py 21 Apr 2003 10:24:13 -0000 1.31 +++ linkie.py 21 Apr 2003 11:37:16 -0000 1.32 @@ -204,7 +204,7 @@ if using after partial linkage.""" if (origin % this._alignment) != 0: raise 'New base address violates alignment', \ - (boundary, this._origin) + (origin, this._alignment) delta = origin - this._origin_secondary for i in range(len(this._symbols)): symbol, value = this._symbols[i] |
From: <di...@us...> - 2003-04-21 11:36:00
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv758 Modified Files: elf.py Log Message: minor cleanup Index: elf.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- elf.py 15 Apr 2003 21:27:31 -0000 1.37 +++ elf.py 21 Apr 2003 11:35:56 -0000 1.38 @@ -611,7 +611,6 @@ binary.paste(-1, section, skip_addr = want_relocatable) if want_symbols: symtab = sections['.symtab'] - symstr = sections['.symstr'] for symbol, value in section.get_symbols(): if symbol[0] == '&': # only process memory references symtab.emit_entry(symbol, value, shentnames.index(name) + 1) |
From: <di...@us...> - 2003-04-21 11:34:41
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv32767 Modified Files: .pycheckrc Log Message: badExceptions = 0 in .pycheckrc Index: .pycheckrc =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/.pycheckrc,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- .pycheckrc 21 Apr 2003 11:28:46 -0000 1.1 +++ .pycheckrc 21 Apr 2003 11:34:38 -0000 1.2 @@ -1,2 +1,5 @@ # First argument to methods methodArgName = 'this' + +# check if raising or catching bad exceptions +badExceptions = 0 |
From: <di...@us...> - 2003-04-21 11:28:53
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv30593a Modified Files: Makefile.am Added Files: .pycheckrc Log Message: added .pycheckrc --- NEW FILE: .pycheckrc --- # First argument to methods methodArgName = 'this' Index: Makefile.am =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Makefile.am 14 Apr 2003 00:05:18 -0000 1.9 +++ Makefile.am 21 Apr 2003 11:28:48 -0000 1.10 @@ -6,8 +6,8 @@ # #### @(#) $Id$ -EXTRA_DIST = .cvsignore struburn.wisp elf.py linkie.py makehello.py \ - elfdump.py +EXTRA_DIST = .cvsignore .pycheckrc struburn.wisp elf.py linkie.py \ + makehello.py elfdump.py all: |
From: <di...@us...> - 2003-04-21 10:24:17
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv27436 Modified Files: linkie.py Log Message: minor fix Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- linkie.py 20 Apr 2003 18:17:02 -0000 1.30 +++ linkie.py 21 Apr 2003 10:24:13 -0000 1.31 @@ -189,7 +189,7 @@ if using after partial linkage.""" if (origin % this._alignment) != 0: raise 'New base address violates alignment', \ - (boundary, this._origin) + (origin, this._alignment) delta = origin - this._origin for i in range(len(this._symbols)): symbol, value = this._symbols[i] |
From: <di...@us...> - 2003-04-21 09:31:00
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv17165 Modified Files: tran.py Log Message: wrote abstract Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- tran.py 17 Apr 2003 12:33:36 -0000 1.30 +++ tran.py 21 Apr 2003 09:30:56 -0000 1.31 @@ -17,6 +17,9 @@ import string import sys +def abstract (this, *arg, **narg): + raise 'abstract method was called', this + class Token: pass class Stackable: def contained_registers (this): |