Finished Main Parser Algorithm (without trees)