Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
.NET Design Patterns

You're reading from   .NET Design Patterns Learn to Apply Patterns in daily development tasks under .NET Platform to take your productivity to new heights.

Arrow left icon
Product type Paperback
Published in Jan 2017
Publisher Packt
ISBN-13 9781786466150
Length 314 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Praseed Pai Praseed Pai
Author Profile Icon Praseed Pai
Praseed Pai
Shine Xavier Shine Xavier
Author Profile Icon Shine Xavier
Shine Xavier
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. An Introduction to Patterns and Pattern Catalogs 2. Why We Need Design Patterns? FREE CHAPTER 3. A Logging Library 4. Targeting Multiple Databases 5. Producing Tabular Reports 6. Plotting Mathematical Expressions 7. Patterns in the .NET Base Class Library 8. Concurrent and Parallel Programming under .NET 9. Functional Programming Techniques for Better State Management 10. Pattern Implementation Using Object/Functional Programming 11. What is Reactive Programming? 12. Reactive Programming Using .NET Rx Extensions 13. Reactive Programming Using RxJS 14. A Road Ahead

The expression evaluator and interpreter pattern


The authors of this book believe that any programmer worth his salt needs to learn the rudiments of compiler construction for implementing mini-languages or domain-specific language (DSL) in his work. A compiler treats expressions as data, and expressions are mostly hierarchical in nature. We use a data structure called AST for representing the nodes of an expression tree. To convert textual expressions into an AST, we need to write a parser to analyze the constituents of an expression. The subsystem which feeds data to the parser is a module called lexical analyzer, which breaks the input stream into a series of tokens.

The definition of a mini language, and writing an evaluator for it, is dealt with by the GoF catalog as interpreter pattern.

In software design, the interpreter pattern is a design pattern that specifies how to evaluate sentences in a (mini) language. The basic idea is to have a class for each symbol (terminal or non-terminal...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image