Changeset 3091


Ignore:
Timestamp:
Apr 28, 2013, 2:04:31 PM (6 years ago)
Author:
cameron
Message:

Add pablo.match compiler support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/Compiler/pablo.py

    r3020 r3091  
    9191
    9292def MkLookAheadExpr(v, i):
    93         return mkCall(mkast.Qname('pablo', 'LookAhead'), [v, ast.Num(i)])
     93        return mkast.call(mkast.Qname('pablo', 'LookAhead'), [v, ast.Num(i)])
    9494
    9595def CompileMatch(match_var, string_to_match):
     
    108108        string_to_match = callnode.args[0].s
    109109        match_var = callnode.args[1]
    110         expr = mkCall('simd_and', [match_var, MkCharStream(string_to_match[0])])
     110        expr = mkast.call('simd_and', [match_var, MkCharStream(string_to_match[0])])
    111111        for i in range(1, len(string_to_match)):
    112                 expr = mkCall('simd_and', [expr, MkLookAheadExpr(MkCharStream(string_to_match[i]), i)])
     112                expr = mkast.call('simd_and', [expr, MkLookAheadExpr(MkCharStream(string_to_match[i]), i)])
    113113        return expr
    114114    else: return callnode
     
    393393                                           ast.Name(callnode.args[1].id, ast.Load())])
    394394      return c
     395    elif is_BuiltIn_Call(callnode,'match', 3):
     396        ast.dump(callnode)
     397        assert isinstance(callnode.args[1], ast.Str)
     398        string_to_match = callnode.args[1].s
     399        match_len = len(string_to_match)
     400        match_var = callnode.args[2]
     401        expr = mkast.call('pablo_blk_match', [callnode.args[0], callnode.args[1], match_var, ast.Num(match_len)])
     402        return expr
    395403    else:
    396404      #dump_Call(callnode)
     
    961969                stream_function.declarations += "\n" + BitBlock_decls_from_vars(t.tempVars())
    962970
    963                 StringMatchCompiler().xfrm(node)
     971                #StringMatchCompiler().xfrm(node)
    964972                AugAssignRemoval().xfrm(node)
    965973
     
    10361044                       
    10371045  def xfrm_block_stmts(self):
    1038     StringMatchCompiler().xfrm(self.main_node)
     1046    #StringMatchCompiler().xfrm(self.main_node)
    10391047    AugAssignRemoval().xfrm(self.main_node)
    10401048    Bitwise_to_SIMD().xfrm(self.main_node)
Note: See TracChangeset for help on using the changeset viewer.