Skip to content

The Pushdown Automaton (PDA) is implemented in this project by using Java programming language. It takes the information about the PDA from a text file and simulate the PDA for given strings.

Notifications You must be signed in to change notification settings

alkinkorkut/Pushdown-Automata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Pushdown-Automata (PDA)

The Pushdown Automaton (PDA) is implemented in this project by using Java programming language. It takes the information about the PDA from a text file and simulate the PDA for given strings. During the simulation progress, it will first provide the path (route taken) about the visited states and at the end the decision is determined whether the string(s) is/are accepted or rejected.

All logic is implemented based on the object oriented programming paradigm. The program reads the input from a text file (“input.txt”) to define the specifications of a pushdown automaton. These inputs consists of number of variables in input and stack alphabet, number of states, number of goal states, states, goal state(s), start state, variables (symbols) of the input and stack, transition relations and string information to be detected by PDA.

Input File Format

• Line 1 consists of number of variables in input alphabet.
• Line 2 consists of number of variables in stack alphabet.
• Line 3 consists of number of goal states.
• Line 4 consists of number of states.
• Line 5 consists of state(s).
• Line 6 consists of start state.
• Line 7 consists of goal state(s).
• Line 8 consists of stack alphabet.
• Line 9 consists of initial stack symbol.
• Line 10 consists of input alphabet.
• Consecutive lines consists of transition relations.
• After transition relations last consecutive lines consists of strings to be detected.

Sample input file:

2
2
2
4
q1 q2 q3 q4
q1
q1 q4
X Y
X
0 1
q1 ε ε X q2
q2 0 ε Y q2
q2 1 Y ε q3
q3 1 Y ε q3
q3 ε X ε q4
0011
0111

Output File Format

The route taken will be written in the first lines. The decision whether the string is accepted or rejected by the PDA will be written after. When the program executes, the output file will be generated if it is not in the directory of the project and the output will be available in the “output.txt”. Also after the execution, the output can be seen in the terminal.

Sample output file:

q1 q2 q2 q2 q3 q3 q4 (route taken)
Accepted
q1 q2 q2 q3 (route taken)
Rejected

Conclusion

Based on the input parameters, the program effectively simulates a pushdown automaton, offering insights into the acceptance or rejection of input strings. Additional improvements might be made for a more complete and adaptable solution.

About

The Pushdown Automaton (PDA) is implemented in this project by using Java programming language. It takes the information about the PDA from a text file and simulate the PDA for given strings.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages