SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
Interpreter
 Abhijit Hiremagalur
 Cogent Consulting
Given a language, define a representation for its
grammar along with an interpreter that uses the
representation to interpret sentences in the
language [GOF, 243]
Domain
   Language
   Grammar
Object Hierarchy
Composite + interpret()
Interpreter
Reverse Polish Notation
3+4
is expressed as
     34+
3-4+5
(3 - 4) + 5 or 3 - (4 +5)

   Which one is it?
543-+
5 (4 3 -) +
  5 (1) +
     6
The code
‘41 2 1 - +’ equals 42
Stack what?
 []
 (41) => [41]
 (2) => [41, 2]
 (1) => [41, 2, 1]
 (-) => [41, 1]
 (+) => [42]
Easy to implement,
change & extend?
Doesn’t address parsing
Use something else if
grammar is complex
Refactor to an
Interpreter when...
“Numerous methods on a
class combine elements of an
      implicit language”
Replace Implicit Language
with Interpreter [Kerievsky]
Interpreter
Interpreter
“Define classes for the
  elements of the implicit
language so that instances
may be combined to form
interpretable expressions.”
A.K.A ?


• Little language
• Macro
• Domain specific language
Domain Specific
Language (DSL)
Internal vs External DSL
Spec productSpec = parse(“price below 9.00f and not coloured white”);




Spec productSpec = both(priceIsBelow(9.00f)).and(not(coloured(WHITE)));
Share symbols with
     Flyweight
Move operations to
     Visitor
The end.

Contenu connexe

Tendances

Tendances (7)

Designing A Syntax Based Retrieval System03
Designing A Syntax Based Retrieval System03Designing A Syntax Based Retrieval System03
Designing A Syntax Based Retrieval System03
 
Regular Expression in Compiler design
Regular Expression in Compiler designRegular Expression in Compiler design
Regular Expression in Compiler design
 
Csr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminskiCsr2011 june17 15_15_kaminski
Csr2011 june17 15_15_kaminski
 
Regular expression (compiler)
Regular expression (compiler)Regular expression (compiler)
Regular expression (compiler)
 
Flat unit 1
Flat unit 1Flat unit 1
Flat unit 1
 
Automata Theory
Automata TheoryAutomata Theory
Automata Theory
 
Chapter Three(2)
Chapter Three(2)Chapter Three(2)
Chapter Three(2)
 

En vedette

Top 10 Reasons Why I Don't Need An Interpreter: Exposing the Myths
Top 10 Reasons Why I Don't Need An Interpreter: Exposing the MythsTop 10 Reasons Why I Don't Need An Interpreter: Exposing the Myths
Top 10 Reasons Why I Don't Need An Interpreter: Exposing the MythsConnecting Cultures
 
Implementing a Simple Interpreter
Implementing a Simple InterpreterImplementing a Simple Interpreter
Implementing a Simple InterpreterRay Song
 
Stefany dodd how to become a interpreter and translator a beginner-s guide-...
Stefany dodd how to become a interpreter and translator   a beginner-s guide-...Stefany dodd how to become a interpreter and translator   a beginner-s guide-...
Stefany dodd how to become a interpreter and translator a beginner-s guide-...Rossi
 
Course Planning - Post Secondary Info Feb 2013
Course Planning - Post Secondary Info Feb 2013Course Planning - Post Secondary Info Feb 2013
Course Planning - Post Secondary Info Feb 2013Terry Ainge
 
Keys to a sustainable interpreting and translation business for freelancers
Keys to a sustainable interpreting and translation business for freelancersKeys to a sustainable interpreting and translation business for freelancers
Keys to a sustainable interpreting and translation business for freelancersHelen Eby
 
Using local culture in English teaching
Using local culture in English teachingUsing local culture in English teaching
Using local culture in English teachingRolando Tellez
 
ASTM Standard for Interpreting and Translation
ASTM Standard for Interpreting and TranslationASTM Standard for Interpreting and Translation
ASTM Standard for Interpreting and TranslationHelen Eby
 
Skills Required To Become a Professional Translator
Skills Required To Become a Professional TranslatorSkills Required To Become a Professional Translator
Skills Required To Become a Professional TranslatorHSS Translation
 
NYC Parking Tickets debunking 3 myths
NYC Parking Tickets debunking 3 mythsNYC Parking Tickets debunking 3 myths
NYC Parking Tickets debunking 3 mythsLawrence Berezin
 
Translation and Interpretation
Translation and InterpretationTranslation and Interpretation
Translation and Interpretationwendo1513
 
Types and modes of interpretation
Types and modes of interpretationTypes and modes of interpretation
Types and modes of interpretationJorge Carro
 
Translation vs. Interpretation
Translation vs. Interpretation Translation vs. Interpretation
Translation vs. Interpretation Rolando Tellez
 
Translation vs. Interpretation
Translation vs. Interpretation Translation vs. Interpretation
Translation vs. Interpretation Rolando Tellez
 
Translation Types
Translation TypesTranslation Types
Translation TypesElena Shapa
 

En vedette (16)

Top 10 Reasons Why I Don't Need An Interpreter: Exposing the Myths
Top 10 Reasons Why I Don't Need An Interpreter: Exposing the MythsTop 10 Reasons Why I Don't Need An Interpreter: Exposing the Myths
Top 10 Reasons Why I Don't Need An Interpreter: Exposing the Myths
 
Implementing a Simple Interpreter
Implementing a Simple InterpreterImplementing a Simple Interpreter
Implementing a Simple Interpreter
 
Stefany dodd how to become a interpreter and translator a beginner-s guide-...
Stefany dodd how to become a interpreter and translator   a beginner-s guide-...Stefany dodd how to become a interpreter and translator   a beginner-s guide-...
Stefany dodd how to become a interpreter and translator a beginner-s guide-...
 
Course Planning - Post Secondary Info Feb 2013
Course Planning - Post Secondary Info Feb 2013Course Planning - Post Secondary Info Feb 2013
Course Planning - Post Secondary Info Feb 2013
 
Keys to a sustainable interpreting and translation business for freelancers
Keys to a sustainable interpreting and translation business for freelancersKeys to a sustainable interpreting and translation business for freelancers
Keys to a sustainable interpreting and translation business for freelancers
 
Using local culture in English teaching
Using local culture in English teachingUsing local culture in English teaching
Using local culture in English teaching
 
ASTM Standard for Interpreting and Translation
ASTM Standard for Interpreting and TranslationASTM Standard for Interpreting and Translation
ASTM Standard for Interpreting and Translation
 
Skills Required To Become a Professional Translator
Skills Required To Become a Professional TranslatorSkills Required To Become a Professional Translator
Skills Required To Become a Professional Translator
 
NYC Parking Tickets debunking 3 myths
NYC Parking Tickets debunking 3 mythsNYC Parking Tickets debunking 3 myths
NYC Parking Tickets debunking 3 myths
 
Thanks for Making That Mistake! Using Errors as an Interpreter Teaching Tool
Thanks for Making That Mistake! Using Errors as an Interpreter Teaching ToolThanks for Making That Mistake! Using Errors as an Interpreter Teaching Tool
Thanks for Making That Mistake! Using Errors as an Interpreter Teaching Tool
 
Translation and Interpretation
Translation and InterpretationTranslation and Interpretation
Translation and Interpretation
 
Types and modes of interpretation
Types and modes of interpretationTypes and modes of interpretation
Types and modes of interpretation
 
Translation vs. Interpretation
Translation vs. Interpretation Translation vs. Interpretation
Translation vs. Interpretation
 
Translation vs. Interpretation
Translation vs. Interpretation Translation vs. Interpretation
Translation vs. Interpretation
 
Methods Of Translation
Methods Of TranslationMethods Of Translation
Methods Of Translation
 
Translation Types
Translation TypesTranslation Types
Translation Types
 

Dernier

Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 

Dernier (20)

201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 

Interpreter