Program to check whether a string will be accepted by a regular grammar or not [closed]

I want to write a C++ program to check whether a string will be accepted by a given regular grammar or not.

The regular grammar can be something like

S->aS
S->bB
B->b

which can be saved in C++ such as map<char, set<string>> so for example here m['S'] = set({"aS", "bB"}).

How do I go about writing the code for this, to validate a string, whether it can be accepted by the given grammar?

Source: Windows Questions C++

LEAVE A COMMENT