Tuesday, October 6, 2009

A context free grammar defining 90% of my voicmails

<message> ::= [<greeting>] [<rationale>] [<request>] [<bye>]

<greeting> ::= <hellotype> [<recipent-name>] [<identification>]

<hellotype> ::= "hi" | "hey" | "hello" | "sup"

<recipent-name> ::= <name>

<identification> ::= ("its" | "this is") <caller-name>

<caller-name> ::= <name>

<rationale> ::= <reason-for-calling> | <statement-of-fact>

<reason-for-calling> ::= ["I" ("was" | "am")] ["just"] "calling" ("because" | (<to-inform-you-of>)) <statement-of-fact>

<to-inform-you-of> ::= "to tell you" | (("to let you know" | "to inform you") ["that"])

<statement-of-fact> ::= "you suck" | "your rent is overdue"

<request> ::= {<connector>} <suggestion>

<connector> ::= "so" | "just" | "please"

<suggestion> ::= "jump off a bridge" | "call me back"

<bye> := (["good"] "bye") | "later" | "peace"