Skip to content

myselfaryan/GrammarForge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GrammarForge: CFG to GNF Converter and String Validator

A sophisticated tool for working with Context-Free Grammars (CFG) and Greibach Normal Form (GNF).

πŸš€ Features

  • Converts any valid Context-Free Grammar (CFG) to Greibach Normal Form (GNF)
  • Validates whether input strings are accepted by the grammar
  • Provides step-by-step transformation process
  • Efficient implementation in Rust for optimal performance

πŸ› οΈ Technical Details

This tool implements the following algorithmic steps:

  1. Elimination of Ξ΅-productions
  2. Removal of unit productions
  3. Conversion to Chomsky Normal Form (CNF)
  4. Final transformation to Greibach Normal Form (GNF)

πŸ“ Prerequisites

  • Rust compiler (rustc)
  • Basic understanding of formal languages and grammars

⚑ Quick Start

# Compile the program
rustc grammar_forge.rs

# Run the executable
./grammar_forge

πŸ” Usage Example

The program will guide you through:

  1. Input your grammar rules
  2. View the transformed GNF
  3. Test strings against the grammar

πŸ’‘ Note

This implementation is part of the Theory of Computation course assignment, demonstrating practical applications of formal language theory.

About

CFG to GNF Converter and String Validator

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages