proj2 - Overview CMSC 330: Organization of Programming...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CMSC 330: Organization of Programming Languages Project 2 – Finite Automata Interpreter CMSC 330 2 Overview • Write Ruby program to implement finite automata – Compose automata representing NFAs • Concatenate • Union • Closure – Convert automata representing NFAs to ones representing DFAs • Subset construction – Minimize automata representing DFAs • Hopcroft reduction • Or any other minimization algorithm… CMSC 330 3 Starting Ruby Code – fa.rb • Class FiniteAutomaton – Can already represent DFAs class FiniteAutomaton def initialize @start = nil # start state @state = { } # all states @final = { } # final states @transition = { } # transitions @alphabet = [ ] # symbols on transitions end – You need to extend it to also represent NFAs CMSC 330 4 Starting Ruby Code – fa.rb • Interpreter and stack – Reads commands, operates on stack def interpreter dfaStack = [ ] loop do case word when /SIZE/ // SIZE command f = dfaStack.last // look at top automata on stack
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

proj2 - Overview CMSC 330: Organization of Programming...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online