GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - note35/Parser-Learning: My parser Implementation for LeetCode problem 227. Basic Calculator II

BranchesTags
Open more actions menu

Latest commit

 

History

11 Commits
11 Commits

Folders and files

NameName
Last commit message
Last commit date
LL1
LL1
 
 
LR0
LR0
 
 
OperatorPrecedence
OperatorPrecedence
 
 
PEG
PEG
 
 
Packrat
Packrat
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Parser-Learning

This repository contains many of my parser Implementation for LeetCode problem 227. Basic Calculator II. I also posted the same content into leetcode discussion, you can check the post there directly.

Why should I learn parser?

A way to dive deep into the details of PEP617 is to get your hands dirty. And leetcode is one of the best online judges to verify the implementation.

Resource to learn Compiler

If you are like me before without a background in language parsing, here is the resource I used.

  • Uncode - GATE Computer Science: Compiler Design lecture: This channel covers LL(1), LR(0), SLR(1), LR(1), CLR(1), LALR(1), and Operator Precedence parser.
  • Packrat Parsing: Simple, Powerful, Lazy, Linear Time by Bryan Ford: The website of Bryan Ford, author of Packrat parser, provides the paper with implementation details and haskell implementation.

Why do I pick 227. Basic Calculator II?

Firstly, Leetcode contains many parsing related questions, 227. Basic Calculator II is one of the simplest one with just enough constraints for learning, which only requires to handle 5 type of symbols: + - * / and number, and all the input strings are valid.

Secondly, before I started my study, there were only LL(1) parser and Operator Precedence parser posts in discussion, LR(0), and Packrat parser were missing. Even if you search the related simple implementation in Google or other search engines, there's actually no organized work like this. (Implement all sorts of parsers for the same problem.)

Unpromised TODO(?)

  • Add CST parser for LL(1)'s non-recursive parser
  • Write PEG parser from scratch

About

My parser Implementation for LeetCode problem 227. Basic Calculator II

Resources

Readme
MIT license
Activity

Stars

6 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.