Skip to content

dxhj/predictive-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

predictive-parser

A simple (naive) LL(1) parser in Python.

  • You can send pull requests, I'd appreciate.

Basic usage

  1. The first parameter receives the start symbol, the second receives the grammar:
parser = PredictiveParser("S", {
  # Each nonterminal contains a list of productions:
  # S -> hello
  "S": [["hello"]]
})
  1. Empty productions are represented by [""]:
parser = PredictiveParser("S", {
  # S -> hello T
	"S": [["hello", "T"]],
	# T -> + | hello | ε
	"T": [["+"], ["hello"], [""]]
})
  1. A complete usage is found in examples.

About

A simple (naive) LL(1) parser written in Python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages