Skip to content
Snippets Groups Projects
Commit 7343ce82 authored by Esteban Prince, Liam (UG - Computer Science)'s avatar Esteban Prince, Liam (UG - Computer Science)
Browse files

Upload New File

parent 0385ec8b
No related branches found
No related tags found
No related merge requests found
// Author: Liam Esteban Prince
// Description: EBNF context free grammar for cooking recipe
%ignore " "
%import common.NUMBER
ambiguator: ("<" | ">" | "less than" | "more than")
// amount: quantity of an ingredient
// eg: 10 - 20 g of pasta
amount: ambiguator* NUMBER+ ("-" | "/" | "to")? NUMBER*
// UNIT: unit of measure
// recognises synonyms or shorthand
// eg: "cup", "grams", "pinch". shorthand: "g", "gr"
UNIT: ("gr" | "g")
// ingredient:
ingredient: modifier* ingredient (modifier ",")*
// modifier: a word or phrase that modifies the ingredient
// eg: "pears, chopped", "chopped pears", "chicken, skin on"
// usually ends in "ed"
modifier: verb | ingredient adverb
adverb:
// UTENSIL: an auxiliary object used by the action
// eg: "bowl", "pan"
UTENSIL: ("bowl" | "pan")
// instruction: a verb applied to one or more ingredients
// does not apply to gerunds like "stirring constantly"
// eg: "mix the bell pepper with the chicken"
instruction: verb ( PREPOSITION ( verb )? PREPOSITION? ( ingredient* | UTENSIL | mixture ) ) PREPOSITION+ UTENSIL
verb:
// mixture: a way to refer to multiple previous ingredients
// usually as a result of a previous step in the method
// eg: "spices", "dry ingredients"
mixture:
// PREPOSITION: word used to link nouns, pronouns, or phrases to other words within a sentence
PREPOSITION: ("with" | "to" | "in" | "of" | "at" | "for" | "off" | "on" | "over" | "under" | "until")
// ARTICLE: word used with a noun to specify grammatical definiteness
ARTICLE: ("a" | "an" | "the")
// CONJUNCTION: word used to connect words, phrases, clauses, or sentences
CONJUNCTION: ("and" | "or" | "but")
// ADJECTIVE:
ADJECTIVE: ("red" | "fast")
// ADVERB:
ADVERB: ("quickly")
// PUNCTUATION
// Ignore punctuation
PUNCTUATION: "."
!start: ADVERB PUNCTUATION+ CONJUNCTION
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment