Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 2.07 KB

README.md

File metadata and controls

41 lines (30 loc) · 2.07 KB

Parsing-tree

Integrative project carried out for the computational mathematics course.

Functionality

A program that reads from a file the elements that define a context-free grammar and applies the top-down parsing process for strings given by the user.

The grammar must be defined in a txt file. The file shall be defined as follows:

  • The first line indicates the set of non-terminal symbols separated by commas, only one uppercase character.
  • The second line indicates the set of terminal symbols separated by commas, only one lowercase character.
  • The third line indicates the start symbol.
  • The following lines indicate the productions of the grammar in the following format: nonTerminalSymbol -> chain terminals or non-terminal symbol

Lambda cannot appear as body of any production. The top-down parsing process receives a string and an integer. The integer indicates the maximum depth of the parsing tree. If this depth is exceeded, the process stops indicating that no solution was found for the string.

The outcome of this process is a png image of the parsing tree.

Dependencies

The functionality of this project relies on the graphviz visualization software to compile the generated dot file into a png image file.

To install graphviz on windows follow the instructions here: Graphviz windows installation.

Remember to add the bin folder path from the Graphviz installation (C:\Program Files\Graphviz 2.44.1\bin) to the system environment variables and restart your pc.

Important notes

This program is built to work on Windows OS.

This program doesn't validate the values in the input file, it assumes that they were built correctly.

Built with

Python Badge Graphviz Badge DOT graph description language Badge