An Interactive Approach to Formal Languages and Automata with JFLAP

Slides:



Advertisements
Similar presentations
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
Advertisements

CPSC Compiler Tutorial 4 Midterm Review. Deterministic Finite Automata (DFA) Q: finite set of states Σ: finite set of “letters” (input alphabet)
About Grammars CS 130 Theory of Computation HMU Textbook: Sec 7.1, 6.3, 5.4.
Theory Of Automata By Dr. MM Alam
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture5: Context Free Languages Prof. Amos Israeli.
Decidable languages Sipser 4.1 (pages ). CS 311 Mount Holyoke College 2 Hierarchy of languages All languages Turing-recognizable Turing-decidable.
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
1 CSC 3130: Automata theory and formal languages Tutorial 4 KN Hung Office: SHB 1026 Department of Computer Science & Engineering.
CS 490: Automata and Language Theory Daniel Firpo Spring 2003.
1 CSCI 3130: Formal Languages and Automata Theory Tutorial 4 Hung Chun Ho Office: SHB 1026 Department of Computer Science & Engineering.
CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG)
January 23, 2015CS21 Lecture 81 CS21 Decidability and Tractability Lecture 8 January 23, 2015.
CS 310 – Fall 2006 Pacific University CS310 Variants of Turing Machines Section 3.2 November 8, 2006.
January 15, 2014CS21 Lecture 61 CS21 Decidability and Tractability Lecture 6 January 16, 2015.
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
MATLAB objects using nested functions MathWorks Compiler Course – Day 2.
Final Exam Review Cummulative Chapters 0, 1, 2, 3, 4, 5 and 7.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 7 Mälardalen University 2010.
Computer Science Concepts Come Alive Susan H. Rodger Duke University Haverford College Philadelphia, PA April 18, 2010 Supported by.
1 Introduction to Parsing Lecture 5. 2 Outline Regular languages revisited Parser overview Context-free grammars (CFG’s) Derivations.
Concepts Come Alive through Visualization and Interaction University of Wisconsin Oshkosh July 16-17, 2009 Susan Rodger Professor of the Practice Duke.
Increasing Engagement in Automata Theory with JFLAP Susan H. Rodger Duke University Visual Thinking Workshop – Duke University May 4,
Increasing Engagement in Automata Theory with JFLAP Susan H. Rodger Duke University SIGCSE 2009 March 7, 2009 Supported by NSF Grant.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
An Interactive and Visual Approach to Learning Computer Science Susan H. Rodger Department of Computer Science Duke University November 30, 2004 This work.
Teaching Strategies and Learning Styles CRA-W Workshop Feb 23, 2005 Susan Rodger Associate Professor of the Practice Duke University
An Interactive Approach to Formal Languages and Automata with JFLAP Susan H. Rodger Duke University NSF CCLI Showcase March 9, 2007 Supported by NSF Grant.
Computer Science Concepts Come Alive Susan H. Rodger Duke University February 20, 2007.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 11 Midterm Exam 2 -Context-Free Languages Mälardalen University 2005.
Increasing Interaction and Support in the Formal Languages and Automata Theory Course Susan H. Rodger Duke University ITiCSE 2007 June 25, 2007 Supported.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 6 Mälardalen University 2010.
Increasing the Use of JFLAP in Courses Susan H. Rodger Duke University Durham, NC USA Program Visualization Workshop June 30, 2011 NSF.
Saeid Pashzadeh Jan 2009 Theory of Computation 1.
Pushdown Automata Chapters Generators vs. Recognizers For Regular Languages: –regular expressions are generators –FAs are recognizers For Context-free.
Cs3102: Theory of Computation Class 8: Non-Context-Free Languages Spring 2010 University of Virginia David Evans.
Compiler Introduction 1 Kavita Patel. Outlines 2  1.1 What Do Compilers Do?  1.2 The Structure of a Compiler  1.3 Compilation Process  1.4 Phases.
CS 3240 – Chapter 5. LanguageMachineGrammar RegularFinite AutomatonRegular Expression, Regular Grammar Context-FreePushdown AutomatonContext-Free Grammar.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Theory of Computing CSCI 356/541 Lab Session. Outline Lab 1: Finite Automata  Construct and Run Construct and Run  Manipulating Transitions Manipulating.
CS130: Theory of Computation An introductory course on the theory of automata and formal languages: models of machines, languages and grammars, relationship.
Computability Review homework. Video. Variations. Definitions. Enumerators. Hilbert's Problem. Algorithms. Summary Homework: Give formal definition of.
SIGCSE 06: NSF Showcase A Visual & Interactive Computability Course Emphasizing Breadth of Automata Rakesh Verma Computer Science Department University.
Formal Languages, Automata and Models of Computation
CSCI 2670 Introduction to Theory of Computing October 13, 2005.
Costas Busch - LSU1 Parsing. Costas Busch - LSU2 Compiler Program File v = 5; if (v>5) x = 12 + v; while (x !=3) { x = x - 3; v = 10; } Add v,v,5.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 2 Context-Free Languages Some slides are in courtesy.
CS 154 Formal Languages and Computability February 11 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2011.
Mid-Terms Exam Scope and Introduction. Format Grades: 100 points -> 20% in the final grade Multiple Choice Questions –8 questions, 7 points each Short.
CS 154 Formal Languages and Computability March 8 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CS510 Compiler Lecture 1. Sources Lecture Notes Book 1 : “Compiler construction principles and practice”, Kenneth C. Louden. Book 2 : “Compilers Principles,
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Decidable.
CS 154 Formal Languages and Computability May 12 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
Review 1.Structure of the course Lexical Analysis Syntax Analysis Grammar & Language RG & DFA Top-down LL(1) Parsing Bottom-Up LR Layered Automation Semantic.
Theory of Computation. Introduction to The Course Lectures: Room ( Sun. & Tue.: 8 am – 9:30 am) Instructor: Dr. Ayman Srour (Ph.D. in Computer Science).
Changes to JFLAP to Increase Its Use in Courses Susan H. Rodger Duke University ITiCSE 2011 Darmstadt, Germany June 29, 2011 NSF Grants.
50/50 rule You need to get 50% from tests, AND
CSE 105 theory of computation
CSCE 355 Foundations of Computation
CSE 105 theory of computation
An Interactive Approach to Formal Languages and Automata with JFLAP
Parsing Costas Busch - LSU.
CS21 Decidability and Tractability
CSE 105 theory of computation
Sub: Theoretical Foundations of Computer Sciences
Theoretical Foundations of Computer Sciences
Presentation transcript:

An Interactive Approach to Formal Languages and Automata with JFLAP NSF Grant DUE CCLI-EMD 0442513 Susan H. Rodger Duke University rodger@cs.duke.edu SIGCSE 2011 AlgoViz Workshop March 9, 2011

Formal Languages and Automata Theory Traditionally taught Pencil and paper exercises No immediate feedback Different More mathematical than most CS courses Less hands-on than most CS courses Programming is in most of their CS courses, not here

Why Develop Tools for Automata? Textual Tabular Visual Interactive

Overview of JFLAP Java Formal Languages and Automata Package Instructional tool to learn concepts of Formal Languages and Automata Theory Topics: Regular Languages Context-Free Languages Recursively Enumerable Languages Lsystems With JFLAP your creations come to life!

JFLAP – Regular Languages Create DFA and NFA Moore and Mealy regular grammar regular expression Conversions NFA to DFA to minimal DFA NFA  regular expression NFA  regular grammar

JFLAP – Regular languages (more) Simulate DFA and NFA Step with Closure or Step by State Fast Run Multiple Run Combine two DFA Compare Equivalence Brute Force Parser Pumping Lemma

JFLAP – Context-free Languages Create Nondeterministic PDA Context-free grammar Pumping Lemma Transform PDA  CFG CFG  PDA (LL & SLR parser) CFG  CNF CFG  Parse table (LL and SLR) CFG  Brute Force Parser

JFLAP – Recursively Enumerable Languages Create Turing Machine (1-Tape) Turing Machine (multi-tape) Building Blocks Unrestricted grammar Parsing Unrestricted grammar with brute force parser

JFLAP - L-Systems This L-System renders as a tree that grows larger with each successive derivation step.

Students love L-Systems

JFLAP’s Use Around the World JFLAP web page has over 300,000 hits since 1996 Google Search JFLAP appears on over 9830 web pages Note: search only public web pages JFLAP been downloaded in over 160 countries

Two-year JFLAP Study Fourteen Faculty Adopter Participants Duke UNC-Chapel Hill Emory Winston-Salem State University United States Naval Academy Rensselaer Polytechnic Institute UC Davis Virginia State University Norfolk State University University of Houston Fayetteville State University University of Richmond San Jose State University Rochester Institute of Technology Two-year JFLAP Study Fourteen Faculty Adopter Participants small, large public, private includes minority institutions

Key Findings All the faculty used JFLAP in their courses They used it mostly for homework, some used it for class demonstrations. Students had a high opinion of JFLAP Four-fifths of the students thought JFLAP was easy to use to draw automata, simulate and interpret the results. The majority of students felt that having access to JFLAP made learning course concepts easier, made them feel more engaged in the course and made the course more enjoyable. Over half of the students used JFLAP to study for exams, and thought that the time and effort spent using JFLAP helped them get a better grade in the course. There was a control group in the second year, but the difference in knowledge between the control group and the JFLAP group was not statistically significant.

JFLAP Materials www.jflap.org JFLAP online tutorial JFLAP works well with Linz book New CD supplement with JFLAP exercises to go with this book JFLAP book

JFLAP Examples in Lecture

Example Create a DFA that recognizes strings with an even number of a’s and an even number of b’s

Example Create a DFA that recognizes strings with an even number of a’s and an even number of b’s

Example – DFA for even binary numbers with an even number of ones

Example – DFA for even binary numbers with an even number of ones

Example: Build an NFA for valid integers Not valid: {006, 3-6, 4.5, …}

NFA for all valid integers

DFA annotated and w/shortcut

Example: NFA run and convert to DFA

Corresponding DFA

Minimize DFA First add trap state q7 then build tree of distinguished states

Final Minimal State DFA

What next? Can convert to a regular expression … Can convert to an NFA…

Using JFLAP during Lecture Use JFLAP to build examples of automata or grammars Use JFLAP to demo proofs Load a JFLAP example and students work in pairs to determine what it does, or fix it if it is not correct.

Example : JFLAP during Lecture Ask students to write on paper an NPDA for palindromes of even length Build one of their solutions using JFLAP Shows students how to use JFLAP

Example 1: JFLAP during Lecture (cont) Run input strings on the NPDA Shows the nondeterminism

Example : JFLAP during Lecture Brute Force Parser Give a grammar with a lambda-production and unit production Run it in JFLAP, see how long it takes (LONG) Is aabbab in L? Transform the grammar to remove the lambda and unit-productions Run new grammar in JFLAP, runs much faster!

Example 2 (cont) Parse Tree Results First Grammar – 1863 nodes generated Second Grammar – 40 nodes generated Parse tree is the same.

With JFLAP, Exploring Concepts too tedious for paper Load a Universal Turing Machine and run it See the exponential growth in an NFA or NPDA Convert an NPDA to a CFG Large grammar with useless rules Run both on the same input and compare Transform grammar (remove useless rules)

NPDA to CFG

JFLAP’s use Outside of Class Homework problems Turn in JFLAP files OR turn in on paper, check answers in JFLAP Recreate examples from class Work additional problems Receive immediate feedback

Ordering of Problems in Homework Order questions so they are incremental in the usage of JFLAP Load a DFA. What is the language? Students only enter input strings. Load a DFA that is not correct. What is wrong? Fix it. Students only modifying a small part. Build a DFA for a specific language. Last, students build from scratch.

Is this a TM for anbncn?

Here is the correct TM for anbncn

Why study finite automata? Application: Compiler Compiler identifies your syntax errors Can write a big DFA to identify all words in a Java program integers, doubles, boolean keywords, variable names arithmetic operators, punctuation symbols Example LR Parser…

Lsystems Another type of grammar Show a simple L-System Show a tree Show a fractal

Unrestricted Grammar - anbncn

Trace aabbcc

Example - Unrestricted Grammar anbmcndm

Example – Unrestricted Grammar (cont)

There are other ways to get interaction in this course besides software…

Interaction in Class – Props Edible Turing Machine TM for f(x)=2x where x is unary TM is not correct, can you fix it? Then eat it! States are blueberry muffins

Students building DFA with cookies and icing