2017-01-20 | Paul Boddie | raw annotate files changeset graph | Confined output program temporary variable management to the translator. Updated the optimiser to employ neutral notation for temporary-related operations for more obvious detection of temporary variable usage. Changed the encoding of attribute access instructions to also return the substitution variables that were found in each access instruction sequence. Changed the output mechanism used during translation to capture function body output so that temporary variable declarations may be computed and emitted before body output. Added a modules dictionary to the translator for potential inspection of the translated modules for each program. |
1 l = range(0, 10) 2 print l # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 3 4 s = slice(2, 5) 5 print s # __builtins__.span.slice(2, 5, 1) 6 7 print l[s] # [2, 3, 4] 8 print l[2:5] # [2, 3, 4] 9 print l[2:5:-1] # [] 10 print l[5:2:-1] # [5, 4, 3] 11 print l[1:9:2] # [1, 3, 5, 7] 12 print l[9:1:-2] # [9, 7, 5, 3] 13 print l[::-1] # [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] 14 print l[::-2] # [9, 7, 5, 3, 1] 15 print reversed(l) # [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]