GithubHelp home page GithubHelp logo

basemax / cfg2cnf Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 1.0 260 KB

Python program to convert a Context Free Grammar to Chomsky Normal Form.

License: GNU General Public License v3.0

Python 100.00%
python cfg cnf context-free-grammar context-free-grammars context-free context-free-language chomsky

cfg2cnf's Introduction

CFG2CNF

Python tool able to convert a Context Free Grammar in Chomsky Normal Form

Convert a Context Free Grammar to Chomsky Normal Form

Python program to convert a Context Free Grammar to Chomsky Normal Form.

I read 7 chapters of the book and the result of my study was writing this program.

References: Formal Languages and Automata

Context Free Grammar Book

An Introduction to Formal Languages and Automata by Peter Linz

What is Chomsky Normal Form

Chomsky Normal Form is a context-free grammar that has been put into a specific format. It was developed by Noam Chomsky in 1978 and is part of formal language theory.

https://en.wikipedia.org/wiki/Chomsky_normal_form

What is Context Free Grammar

https://en.wikipedia.org/wiki/Context-free_grammar

Using

git clone https://github.com/BaseMax/CFG2CNF
cd CFG2CNF
python main.py

Input

S -> SaB | aB
B -> bB | $
*

The above grammar is equivalent to the following grammar:

S -> SaB
S -> aB
B -> bB
B -> $
*

Automata is useful?

The image below will change your think of the Automata:

Grammer sample image

Sure, We are need this subject all of the day, Also programming languages!

Follow this way by reading following book.

If you find a problem or bugs in program, please send Issue or PR, i'm a new member in this study...

Automata Videos

Learn in some videos:

Thanks to Khalilian for providing these videos and the great help he did.

Good for start to check Mini Calculator Interpreter project.


Max Base

My nickname is Max, Programming language developer, Full-stack programmer. I love computer scientists, researchers, and compilers. (Max Base)

Asrez Team

A team includes some programmer, developer, designer, researcher(s) especially Max Base.

Asrez Team

cfg2cnf's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

d-e-f-e-a-t

cfg2cnf's Issues

I can't get ouput!

Hello Dear BaseMax :) after inputting some CFG grammar the program doesn't return anything can you help me?!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.