Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Clojure Data Structures and Algorithms Cookbook

You're reading from   Clojure Data Structures and Algorithms Cookbook 25 recipes to deeply understand and implement advanced algorithms in Clojure

Arrow left icon
Product type Paperback
Published in Aug 2015
Publisher
ISBN-13 9781785281457
Length 216 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Rafik Naccache Rafik Naccache
Author Profile Icon Rafik Naccache
Rafik Naccache
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Revisiting Arrays 2. Alternative Linked Lists FREE CHAPTER 3. Walking Down Forests of Data 4. Making Decisions with the Help of Science 5. Programming with Logic 6. Sharing by Communicating 7. Transformations as First-class Citizens Index

Building a simple shift-reduce parser

A shift-reduce parser is a program that is generated from a grammar definition. It is a kind of state machine capable of doing two kinds of actions:

  • Either it consumes a token from an input program, adding up a new state in a stack. This is called shifting.
  • It recognizes that a rule of grammar has been fully matched, so it pops as many states from the stack as the rule contains and acknowledges that it recognized that particular rule, adding up an entry to the parse tree. This is known as reducing.

Given how these parsers operate, we'd say that they belong to the "bottom-up" parsing family. That is, they operate on input and deduce the parse outcome while traversing it, in contrast to the other way around, which is starting from the rules of grammar and finding structures in the program that obey them. Our parser will then operate on a linked list structure, consuming tokens one after another.

Now, a particular state of the parser depicts...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Clojure Data Structures and Algorithms Cookbook
You have been reading a chapter from
Clojure Data Structures and Algorithms Cookbook
Published in: Aug 2015
Publisher:
ISBN-13: 9781785281457
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
Modal Close icon
Modal Close icon