Parser Duties - Deepstash
Machine Learning With Google

Learn more about computerscience with this collection

Understanding machine learning models

Improving data analysis and decision-making

How Google uses logic in machine learning

Machine Learning With Google

Discover 95 similar ideas in

It takes just

14 mins to read

Parser Duties

The parser adds structure to to the ordered list of tokens the lexer produces. To stop ambiguities, the parser must take into account parenthesis and the order of operations. 

Simply parsing operators isn’t terribly difficult, but as more language constructs get added, parsing can become very complex. 

14

34 reads

MORE IDEAS ON THIS

Lexing

The first step in most programming languages is lexing, or tokenizing. ‘Lex’ is short for lexical analysis, a very fancy word for splitting a bunch of text into tokens. 

The word ‘tokenizer’ makes a lot more sense, but ‘lexer’ is so much fun to say that I use it anyway. 

15

96 reads

Action Tree vs AST

Put simply, the action tree is the AST with context. That context is info such as what type a function returns, or that two places in which a variable is used are in fact using the same variable. 

Because it needs to figure out and remember all this context, the code that g...

14

27 reads

Running the Action Tree

Once we have the action tree, running the code is easy. Each action node has a function ‘execute’ which takes some input, does whatever the action should (including possibly calling sub action) and returns the action’s output. This is the interpreter in action. 

14

46 reads

Bison

The predominant parsing library is Bison. Bison works a lot like Flex. You write a file in a custom format that stores the grammar information, then Bison uses that to generate a C program that will do your parsing. I did not choose to use Bison. 

14

33 reads

Tokens

A token is a small unit of a language

A token might be a variable or function name (AKA an identifier), an operator or a number. 

14

62 reads

Parsing

The parser turns a list of tokens into a tree of nodes. A tree used for storing this type of data is known as an Abstract Syntax Tree, or AST. 

At least in Pinecone, the AST does not have any info about types or which identifiers are which. It is simply structured tokens. 

14

41 reads

Why Custom Is Better

  • Minimize context switching in workflow: context switching between C++ and Pinecone is bad enough without throwing in Bison’s grammar grammar
  • Every time grammar changes bison has to be run before the build.
  • A custom Parser is completely doable.

14

30 reads

Choosing a Language

If you are writing an interpreted language, it makes a lot of sense to write it in a compiled one (like C, C++ or swift).

 If you plan to compile, a slower language (like python or Javascript) is more acceptable.

14

166 reads

High Level Design

A programming language is generally structured as a pipeline. That is, it has several stages. 

Each stage has data formatted in a specific, well defined way. It also has functions to transform data from each stage to the next. 

15

124 reads

Compiled vs Interpreted

Compiled vs Interpreted

There are two major types of languages: compiled and interpreted: 

  • A compiler figures out everything a program will do, turns it into “machine code”, then saves that to be executed later. 
  • An interpreter steps through the source code line by line, figuring out what it’s doing a...

16

124 reads

CURATED FROM

CURATED BY

mipham

Holiday representative

Related collections

More like this

Why accepting emotions is helpful

What is the point of trying to accept your emotions, and wouldn’t it be easier to simply get rid of them? 

Well, no, it isn’t easy to get rid of emotions. In fact, most people with BPD have tried to get rid of their emotions with little success. What they have learned, and what rese...

Types of people

Types of people

Category 1: Losers

People who always see negative in everything and put in the least amount of effort or no effort at all. They are least bothered about what is happening around them. They will only crib and complain about how the world is. They will say someth...

7 Things You Need To Understand About Anxiety And Depression

No, we are not over yet. After discussing the topic with my friend’s Dad (he is a doctor), I’ve made a list of things you need to understand and avoid anxiety attacks (hard to breathe moments).

  1. Think of your anxiety as a biological problem, rather than thinking there is something wron...

stash-superman-illustration

Explore the World’s

Best Ideas

200,000+ ideas on pretty much any topic. Created by the smartest people around & well-organized so you can explore at will.

An Idea for Everything

Explore the biggest library of insights. And we've infused it with powerful filtering tools so you can easily find what you need.

Knowledge Library

Powerful Saving & Organizational Tools

Save ideas for later reading, for personalized stashes, or for remembering it later.

# Personal Growth

Take Your Ideas

Anywhere

Organize your ideas & listen on the go. And with Pro, there are no limits.

Listen on the go

Just press play and we take care of the words.

Never worry about spotty connections

No Internet access? No problem. Within the mobile app, all your ideas are available, even when offline.

Get Organized with Stashes

Ideas for your next work project? Quotes that inspire you? Put them in the right place so you never lose them.

Join

2 Million Stashers

4.8

5,740 Reviews

App Store

4.7

72,690 Reviews

Google Play

Sean Green

Great interesting short snippets of informative articles. Highly recommended to anyone who loves information and lacks patience.

Ashley Anthony

This app is LOADED with RELEVANT, HELPFUL, AND EDUCATIONAL material. It is creatively intellectual, yet minimal enough to not overstimulate and create a learning block. I am exceptionally impressed with this app!

Shankul Varada

Best app ever! You heard it right. This app has helped me get back on my quest to get things done while equipping myself with knowledge everyday.

samz905

Don’t look further if you love learning new things. A refreshing concept that provides quick ideas for busy thought leaders.

Jamyson Haug

Great for quick bits of information and interesting ideas around whatever topics you are interested in. Visually, it looks great as well.

Ghazala Begum

Even five minutes a day will improve your thinking. I've come across new ideas and learnt to improve existing ways to become more motivated, confident and happier.

Giovanna Scalzone

Brilliant. It feels fresh and encouraging. So many interesting pieces of information that are just enough to absorb and apply. So happy I found this.

Laetitia Berton

I have only been using it for a few days now, but I have found answers to questions I had never consciously formulated, or to problems I face everyday at work or at home. I wish I had found this earlier, highly recommended!

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Access to 200,000+ ideas

Access to the mobile app

Unlimited idea saving & library

Unlimited history

Unlimited listening to ideas

Downloading & offline access

Personalized recommendations

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates