FB language
This is an example of "domain specific language" design. Two sample
sentences in this language:
1) Task: Add a friend's name to FB.
open FB
touch SEARCH
input NAME
touch ADDFRIEND
2) Task: Upload a picture to FB.
open FB
touch PHOTO
select PICTURE
input NAME
touch SHARE
Note that I simplify a lot of things such as the "input" some how
brings up a keyboard and users type in the name which I use the
terminal symbol "NAME".
Given these two sentences, we can write a grammar describing this
language (a generalisation).
verb := open | touch | input |
select
noun := FB | SEARCH | NAME |
ADDFRIEND |
PHOTO | PICTURE | SHARE
action := ( verb noun ) *
or we can also write
action := verb noun action |
empty
When we parse the first sentence "open FB touch PHOTO select PICTURE
input NAME touch SHARE", here is the parse tree:
action --
|--action --
|
|--verb -- open
|
|--noun -- FB
|
|--action --
|
|--verb -- touch
|
|--noun -- SEARCH
|
|--action --
|
|--verb -- input
|
|--noun -- NAME
|
|--action --
|--verb -- touch
|--noun -- ADDFRIEND
end