# Pattern recognition Program that parses a regular expression and transforms it into a finite automaton, which is used to see if a string given by the user matches (the string is able to be made with the given regular expression). The program can also output the finite automaton to a file in the [DOT-language of graphviz](https://graphviz.org/doc/info/lang.html), which can be used to show a graphical representation of the finite automaton by using the graphviz package to transform the .dot file to, for example, a .png file. This project was a school project made in a group and on a git of the University. I therefore copied the whole project to this (private) repository. The language of the program, comments and (most) variables are in Dutch, since the course of this project was also in Dutch. If anything is unclear feel free to contact me. ## Grammar The program works for all possible regular expressions from the following grammar: * \ := \ \[ | \ \] * \ := \ \[ \ ] * \ := \ \[ \* \] | \( \ \) \[ \* \] * \ := a | b | ... | z | $ The '$' stands for an empty string. We can therefore input the empty language with "$" as regular expression. Note that "a$a" is the same as "aa". ## Matching After a regular expression is given, the user can check if strings are in the language of the given regular expression. We for example put in the regular expression "c*(aa|b)*de", then when we check "ccaabde" this will give us a match and when we check for example "c" this will give us no match. ## Graphical representation An other option is making a file containing the DOT-notation of the finite automaton of the given regular expression. This file should be given with the ".dot" extension, since graphviz probably does not work for other extensions. After making this .dot file we can transform it into a graphical representation of the finite automaton with the graphviz package. There is also a script given which does this transofmation to .png files for every .dot file in the directory. ## Debugmode The program can be run in debugmode, which turns off the printing of the menu of the progam, by giving the argument 'd' in the commandline. This is useful to test file containing instructions for the program, for example "./patroonherkenning d < file.txt". ## My contribution This project was made with a classmate, I therefore did not program all the code in this project. The following is my contribution: * parser\[.h\]|.cc * firstTransition, concat, plus, star, addState funtions in automaton\[.h\]|.cc * main, menu, exp functions in main.cc * makedot.sh