Skip to content

Context-free grammar interpreter. The interpreter takes as input a context-free grammar and a string to parse and gives an output whether the test string is either accepted or rejected.

License

Notifications You must be signed in to change notification settings

minji-mia/CFGI-Interpreter-GUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CFGI-Interpreter-GUI

The project is for a context-free grammar interpreter. The interpreter takes as input a context-free grammar and a string to parse and gives an output whether the test string is either accepted or rejected. The program is implemented in a GUI, using Python.

cfgi

Program Overview

It consists of three files. One is for setting context free grammar and parsing string and another is for setting up UI layout and last one is for setting button signal and slots to use context free grammar interpreter. The below code is developed in Python language.

Demo

image

image

Presentation on Youtube

Watch the video

Example

Context Free Grammar

  • S → aaaaS|A|B|C
  • S → D|E|ɛ
  • A → m|AC
  • A → aB|c|D
  • A → aa
  • B → ae|BE|ɛ|azz
  • B → Cd
  • C → i|D
  • C → u|ɛ|o
  • D → n|E|t|at
  • D → y|ɛ
  • E → j|r|D|F
  • E → CBF
  • F → lolF|h|g
  • F → d|kkk

Derivation Trees

Strings are accepted by grammar:

  • minji

image image

Strings are not accepted by grammar:

  • car: The grammar cannot produce ‘ar’

image

Built with

License

This project is licensed under the MIT License

About

Context-free grammar interpreter. The interpreter takes as input a context-free grammar and a string to parse and gives an output whether the test string is either accepted or rejected.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages