SlideShare una empresa de Scribd logo
1 de 29
Descargar para leer sin conexión
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()
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]
“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.

Más contenido relacionado

La actualidad más candente

La actualidad más candente (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)
 

Destacado

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
 

Destacado (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
 

Último

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 

Último (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 

Interpreter