Skip to content

Gbell26/Recursive-Descent-parser

Repository files navigation

A recursive descent parser that takes an input and determines whether it is a valid expression according to the following grammar rules:

<expr> ::= <term> * <term>
<expr> ::= <term> - <term>
<expr> ::= <term>
<term> ::= <factor> / <factor>
<term> ::= <factor> + <factor>
<term> ::= <factor>
<factor> ::= <identifier> | <number> | (<expr>)
<identifier> ::= <alpha><alphanumrest> | <alpha>
<alphanumrest> ::= <alphanum><alphanumrest>|<alphanum>
<alphanum> ::= <alpha> | <digit>
<number> ::= <nonzerodigit><rest>|<digit>
<rest> ::= <digit><rest>|<digit>   
<nonzerodigit> ::= 1|2|3|4|5|...|9
<digit> ::= 0|1|2|3|4|5|...|9
<alpha> ::= a|b|c...|y|z|A|B|...|Y|Z|_

A few sample input/outputs: Screenshot 2023-03-05 204217 Screenshot 2023-03-05 204258 Screenshot 2023-03-05 204431 Screenshot 2023-03-05 204538

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages