interpreter pattern rulecustomerisa(member)percentagediscount("any_item" during happy hourwhich happens from : to : weekdaysall drinks are less rules appendruleand(timeisbetween(" : "" : ")todayisaweekday())percentagediscount(drink mondays are buy one get one free burger nights rules appendruleand(todayis(monday)numberofitemsoftype(burger ))cheapestfree(burgerfor rule in rulestab discounts append(rule evaluate(tab)print"calculated cost{}\ndiscount applied{}\nformattab calculate_cost()tab calculate_discount(in this you saw two ways of interpreting grammar and internal dsl we looked at the composite patternthen used it to interpret rule for specials in restaurant thenwe built on that ideatogether with the general interpreter patternto develop more complete interpreter to test conditions and calculate what discounts apply essentially you worked through the whole process from getting business requirements to defining the problem in terms of dsl and then implementing the dsl in code