Skip to content

JohanLee2000/LexicalParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LexicalParser

Rust program to map out BNF structures and produce a “diagrammed” version of the input string, which means a sentence in properly parenthesized form. “Properly parenthesized” means that each non-terminal appearing in the input string now has parentheses around it. For instance, the input string:

alice found mean green book

would be parenthesized as

(((alice)) (found) (((mean(green))book)))

Here is the structure used: --> <verb_phrase> --> <noun_phrase> <verb_phrase> --> | --> <noun_phrase> <noun_phrase> --> [<adj_phrase>] [<prep_phrase>] <adj_phrase> --> | <adj_phrase> <prep_phrase> --> <noun_phrase>

The program will also note two distinct error conditions. First, if a given string does not consist of valid tokens, then respond with this message:

Input has invalid tokens.

Second, if the parameter is a string consisting of valid tokens but it is not a legitimate sentence according to the grammar, then respond with the message:

Input is not a sentence.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages