Skip to content

Java Implementation of Pushdown Automata with Tokeniser and Parser

License

Notifications You must be signed in to change notification settings

alvinylt/pda-java-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pushdown Automata with Java Tokeniser and Parser

This repository contains a tokeniser and a parser with Java which demonstrate the implementation of formal grammar and a pushdown automaton.

The example grammar has the following production rules:

  • $S \to \epsilon$
  • $S \to aSb$

The corresponding pushdown automaton as define with the following transitions:

  • $\delta (S_{0}, \epsilon, Z) \mapsto S_{3}/Z$
  • $\delta (S_{0}, a, Z) \mapsto S_{1}/aZ$
  • $\delta (S_{1}, a, a) \mapsto S_{1}/aa$
  • $\delta (S_{1}, b, a) \mapsto S_{2}/\epsilon$
  • $\delta (S_{2}, b, a) \mapsto S_{2}/\epsilon$
  • $\delta (S_{2}, \epsilon, Z) \mapsto S_{3}/Z$

The stack starts with $Z$. $S_{0}$ is the starting state whilst $S_{3}$ is the terminal state.

PDA transition diagram

@author: Alvin Tang [email protected]

@last-updated: 2023-04-30

About

Java Implementation of Pushdown Automata with Tokeniser and Parser

Topics

Resources

License

Stars

Watchers

Forks