[Tutor] token parser

Dj Gilcrease digitalxero at gmail.com
Sun Feb 11 09:19:30 CET 2007


How would I go about writing a fast token parser to parse a string like
"[4d6.takeHighest(3)+(2d6*3)-5.5]"

and get a list like
['+',
    ['takeHighest',
        ['d',
            4,
            6
        ],
        3
    ],
    ['-',
        ['*',
            ['d',
                2,
                6
            ],
            3
        ],
        5.5
    ]
]

back? ( I put it all separated and indented like that so it is easier
to read, it is for me anyways )


More information about the Tutor mailing list