NOTE: python 3.2
I want to make a python script that recieves c++ simple expressions as input, and outputs the very same expressions as tokens.
I vaguely remember my course in compilation, and I need something far less complex than a compiler.
Examples
int& name1=arr1[place1];
int *name2= arr2[ place2];
should output
[ "int", "&", "name1", "=", "arr1", "[", "place1", "]" ]
[ "int", "*", "name2", "=", "arr2", "[", "place2", "]" ]
The spaces shouldn't matter, and I don't want them in the output.
This seems like a very simple task for someone who knows what they're doing, while I keep getting garbage white spaces or getting the division at wrong places.
I would greatly appreciate a quick solution for this - it really looks like a one-liner to me
Note that I only need expressions like I showed here. Nothing fancy.
Thanks