Intro to parsing
The rules matter
Dear John:
I want a man who knows what love is all about. You are generous, kind, thoughtful. People who are not like you admit to being useless and inferior. You have ruined me for other men. I yearn for you. I have no feelings whatsoever when we’re apart. I can be forever happy–will you let me be yours?
Jane
VS
Dear John,
I want a man who knows what love is. All about you are generous, kind, thoughtful people, who are not like you. Admit to being useless and inferior. You have ruined me. For other men, I yearn. For you, I have no feelings whatsoever. When we’re apart, I can be forever happy. Will you let me be?
Yours,
Jane
One more:
Let's eat, grandma
How could that possibly go wrong?
A CS example
Steps:
- Press Export in the top left
- Press the blue Export button
- save as "map.osm"
- open in any text editor/JGrasp (Sublime is best)
Today's task:
- Form groups of 2 or 3
- Write one method
getWayName (String[] osm, int i)
that usesgetAttribute
to print the name of a road (type = "way") - In the main, print the names of all the roads (type = "way") in your parsed file.
- Show to a TA
Parsing language
Check this video (use headphones or at home): parsing grammar
Parsing as part of compilation
Check this video (use headphones or at home): parsing for compilation