Semantic Analysis Program in Python