Next Higher-Order Parsing 10 

字句解析Lexing

        # (x^2 + 3*x) * sin(x * 2) + 14
        (["("], ["VAR", "x"], ["^"], ["NUMBER", 2], ["+"],
         ["NUMBER", 3], ["*"],  ["VAR", "x"], [")"],
         ["FUNCTION", "sin"], ["("], ["VAR", "x"], ["*"],
         ["NUMBER", 2], [")"], ["+"], ["NUMBER", 14])
        sub type  { my $token = shift; $token->[0] }
        sub value { my $token = shift; $token->[1] }

Next Copyright © 2007 M. J. Dominus