Changeset 3418 for proto/RE/demo


Ignore:
Timestamp:
Jul 31, 2013, 11:34:09 PM (6 years ago)
Author:
ksherdy
Message:

Added conceptual stages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/RE/demo/grep.py

    r3416 r3418  
    44# grep Program flow.
    55#
    6 # StreamInput -> PrependLF -> Transpose -> ClassifyBytes -> Match -> MatchLines -> (FilterMatchLines) -> StreamOutput
     6# StreamInput' -> PrependLF' -> Transpose -> ClassifyBytes -> Match -> MatchLines -> (FilterMatchLines) -> StreamOutput'
    77#                                                                     
    88# Notes/Observations:
     
    1919#       Potential solutions:
    2020#
    21 #       a) manipulate source input stream, ie. prepend LF
    22 #       b) compiler code handles
    23 #       c) developer code handles (shift both
     21#       a) prototype code handles with modification to source input stream, ie. srli<1> input stream | pablo<8>.SetValue(0,LF)
     22#
     23#    pablo.SetValue<8>(integer index, integer value)
     24#
     25#       b) prototype code handles with modification to pablo.SpanUpTo, pablo.InclusiveSpan, pablo.ExclusiveSpan
     26#
     27#       c) prototype code handles with 'artificial 1 bit set at 0th byte index'
     28#    then OR in a 1-bit at 0th position 'if while' versus 'while'
    2429#
    2530#
     
    101106                        #next_end = pablo.Advance(cursor)
    102107                        #next_end = pablo.ScanTo(cursor, lex.LF)
    103                         lines.all_lines |= pablo.ExclusiveSpan(last_start, next_end) | next_end # e but not s hmmm?
     108                        lines.all_lines |= pablo.ExclusiveSpan(last_start, next_end) | next_end
    104109                        cursor = next_end
    105110                if(cursor & lex.LF):
     
    112117        output.lines = pablo.filter_bytes(u8data, ~lines.all_lines)
    113118       
    114 
    115 
    116 basis   = Basis()
    117 lex     = Lex()
    118 matches = Matches()
    119 lines   = Lines()
    120 output  = Output()
     119basis_bits      = Basis()
     120lex           = Lex()
     121matches     = Matches()
     122lines       = Lines()
     123output      = Output()
    121124
    122125if __name__ == "__main__":
    123126        #print "Starting ..."
    124127        if len(sys.argv) > 1:
     128
     129    # ReadStreamInput(u8data)
    125130                u8data = pablo.readfile(sys.argv[1])
    126                 pablo.EOF_mask = pablo.transpose_streams(u8data, basis)
    127                 ClassifyBytes(basis, lex)
     131
     132    # PrependLF(u8data)
     133
     134    # Transpose(u8data, basis)
     135                pablo.EOF_mask = pablo.transpose_streams(u8data, basis_bits)
     136                ClassifyBytes(basis_bits, lex)
    128137                Match(lex, matches)
    129138                MatchLines(lex, matches, lines)
    130139                FilterMatchLines(u8data, output)
    131140
     141    # WriteStreamOutput(Output)
    132142                lgth = len(u8data)
    133143                print "\nstream input data:     \n\n" + u8data
Note: See TracChangeset for help on using the changeset viewer.