Skip to content

A simple SLR parser, which recognizes/check SLR grammar and then checks if the input string is a valid expression or not.

Notifications You must be signed in to change notification settings

gsmanu007/SLR-parser

Repository files navigation

SLR-parser

A simple SLR parser, which recognizes/check SLR grammar and then checks if the input string is a valid expression or not.

Usage:

from command line: @python slr.py "(Grammar File)" "(Input expression to be parsed)" example: python slr.py "slr.txt" "(id + id)* id + id"

SLR grammar can be edited in the file "slr.txt" first line in grammar file should include all non-terminals.

check.py checks if the grammar is SLR grammar or not.

graph.py generates the closure of items given by the grammar and writes it in file called "closure.txt".

slr_parser.py then calls graph.py and uses closure generated by graph.py to construct SLR table and validate the input string.

About

A simple SLR parser, which recognizes/check SLR grammar and then checks if the input string is a valid expression or not.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages