CSE Theory of Computing Spring 2018 Project 2-Finite Automata

Size: px
Start display at page:

Download "CSE Theory of Computing Spring 2018 Project 2-Finite Automata"

Transcription

1 CSE Theory of Computing Spring 2018 Project 2-Finite Automata Version 2 Contents 1 Overview Updates Valid Options Project Options Platform Options Teaming Options Overall Combinations Programming Options Honor Code Considerations Program Details DFA DFA Machine Format DFA Simulation Output Implementation on Arduino Instructor-Supplied Test Files FST FST Machine Format FST Simulation Output Implementation on an Arduino NFA-to-DFA Translator Regex to NFA Student-supplied Test Cases Documentation readme-team teamwork-netid Submission 8 6 Grading Extra Credit

2 1 Overview The goal of this project is to have each student understand at a deep level the functioning of a finite automaton (FA), how programs for such a machine should be written, and what we mean by complexity of such programs when executed on real inputs. This design should set the stage for later projects on alternative classes of automaton. This project is designed to give students a relatively wide range of options, both in what is attempted, the platform on which the project is executed, and how teaming with other students may be performed. Each option is designed so that each student will have approximately the same amount of educational experience. Each team shall adopt a team name that is used as part of all program names, and referenced in documentation. For a one-person team you can use your netid. 1.1 Updates Version 2: Updated how to document project correctness, esp. for Arduino where a demo to instructor will be sufficient. Activated the description of grading Section 6. 2 Valid Options 2.1 Project Options The project has a spectrum of different program options that may be pursued: dfa: a deterministic finite automata simulator that is capable of accepting a description of a DFA and then executing that machine against a set of strings, reporting back for each whether or not the string was accepted by the machine. fst: a finite state transducer that operates just like a DFA but also outputs a character at each transition that may be used to interact with the outside world. It should be possible to run an FST simulator as a simple DFA also. nfa2dfa: a program that takes a valid description of an NFA, and creates a valid description of a DFA that accepts exactly the same language. This DFA description shall be executable on a dfa simulator. regex2nfa: a program that takes a regular expression and creates an NFA that accepts it. The description of an NFA should be compatible with a nfa2dfa program, which means that it can be translated into a form that can be run on a DFA simulator. The nfa2dfa and regex2nfa are to be compatible with either a DFA or FST simulator. 2.2 Platform Options There are two platforms on which this project may be run: totally on a conventional computer such as your laptop or the student machines, an Arduino single board embedded computer, and/or a mix of Arduino and conventional platforms. 2.3 Teaming Options There are also two teaming options possible. First is collaborative where the members of the team may freely share development and coding, submit single sets of code and documentation, and receive a common grade. Second is inter-operable where one student/team develops their own code and documentation independently, but may use the programs produced by other students/teams to prove out their code. An example of the latter might be for a student who is interested in development of just a regex2nfa module, and uses the nfa2dfa and dfa from other teams to prove it out. In such cases, each student/team receives an independent grade based on just their own work and submission. 2.4 Overall Combinations In a collaborative team, groups of up to three students may work freely together. The number and mix of programs that must be written depends on the number of students, and include the following options: 2

3 Single student: any one of the following: fst on a conventional computer dfa on an Arduino nfa2dfa on a conventional computer (Requires an inter-operable agreement with some other team that has a dfa) regex2nfa on a conventional computer (Requires an inter-operable agreement with some other team that has a dfa and a nfa2dfa) The rationale for requiring only a simpler DFA rather than an FST when running on an Arduino is to reflect the need for additional programming on both the host and the Arduino side to transfer data from host to Arduino, and back. Two person collaborative teams: fst on an Arduino, including designing demo examples that interact with the real world, providing inputs from physical sensors and driving physical output devices. The instructor has a wide supply of material for such demonstrations. dfa and nfa2dfa on a conventional computer. The nfa2dfa must drive the dfa simulator. nfa2dfa and regex2nfa on a conventional computer. (Requires an inter-operable agreement with some other team that has a dfa) a three person collaborative team is expected to develop all three of fst, nfa2dfa, and regex2nfa. Other combinations may also be possible - see the instructor for permission. 2.5 Programming Options You are free to use C, C++, Python, or even (ideally) the C environment for your Arduino. On conventional machines, Python in particular has proven in the past as perhaps the most efficient way to get decent working code (the overall goal). If you use Python, feel free to use the time, csv, sys, copy, itertools, and pygame modules. Use of any other modules requires preapproval of the instructor. Many of the files are defined to be in csv format, a text file format where each line is a series of text strings separated by commas. The Python csv library is particularly useful for processing such files. Note that the use of spreadsheets for generating test files is useful, since there is typically a save as.csv option. Note also that it may be that such files are produced on a Windows machine that adds a carriage return and a linefeed to the end of each line, versus just a line feed under Linux. If you use your Arduino, you may use any built-in library. Any other libraries should be passed by the instructor before use. Also the instructor has a few display units and quite a few Arduino-compatible sensors and actuators that can be loaned out, along with documentation on drivers. 2.6 Honor Code Considerations In any case, all aspects of the ND Honor Code ( and CSE-specific interpretation ( are in effect. Members of a team are free to share code within themselves but not with students outside the team. In an inter-operable arrangement, neither student team can look at or be involved in the development of the other team s code, although reporting bugs is permissible. Also in such an arrangement, failure of one side to complete coding in a timely fashion is not an excuse for the other side. In no case is any code from outside the class, other that that explicitly authorized either here or by the instructor, is allowed. In particular, this includes code from prior years projects that may have been similar. 3 Program Details Completion of this project will involve two parts. First is developing each required module. Doing this involves both programming and algorithm understanding. Second is developing your own automata, and then using your tools to simulate it and show it does what you expect. We are not after world-class performance or beautiful code here, but just some relatively simple code that is functional and from which you can draw insight. You are free to go beyond the minimal requirements 3

4 and produce enhanced code, and if in the instructor s view it truly represents valuable extensions, then it will be considered for extra credit (see Section 6.1). 3.1 DFA This program, to be named dfa-team, where team is the name of your team, will simulate a DFA that is programmed to accept/reject strings depending on if they are members of some language. It must take two files at input: an input machine file defining the DFA to be simulated (Section 3.1.1), and an input file providing multiple character strings to run one at a time against the machine. After reading in the machine file, this program should read the second file one line at a time. Each line is a character string represents a separate input string for running on the DFA. Before each string is processed from the second file, the simulated DFA should be reset to its start state, and all statistics should be cleared. The name of the test file shall be echoed to stdout. Then the FA should be allowed to run against the next line of text from the input file. At the end, your program should signal if the string was accepted or not. Section defines the output that should be generated during the simulation. In designing your simulator, you should design in an automatic Trap state to which any combination of state and input not defined by the machine file should go. This trap state is assumed to be part of all designs, and need not be defined in the machine file. It is never in the set of final states. It is there to both catch errors in machine descriptions and to simplify the description of DFAs. A DFA designer is of course permitted to define and use their own trap state DFA Machine Format A file providing the rules for a DFA shall consist of a.csv file where each line provides distinct information about the DFA as follows: Line 1: The name of the machine being defined. This should be echoed to stdout before the rules are echoed. Line 2: Σ - the alphabet to be used as input: only single ASCII letters are allowed, comma separated, as in a,b,c,... Any ASCII character other than or, is allowed. The character is reserved to stand for ɛ in transition rules for NFAs. Line 3: Left blank (here for compatibility with FST designs) Line 4: Q - the names of the states, separated by commas, as in q0, q1,... There is no constraint on the length or character set of a state name. Line 5: q 0 -The name of the state that should be considered the start state. Line 6: F - A comma separated list of state names that should be marked as accepting states. Line 7 and beyond: δ - one transition rule per line, in a comma-separated format: Initial State Name, Input Symbol, New State Name The Input Symbol is any symbol from the defined Σ from line 2, or (when describing an NFA) optionally a that stands for an ɛ. This file should be read in by your simulator, and internally processed to whatever representation you are using to represent the transition function. As each rule is read in, an integer Rule # should be associated with it, assigned in sequential order. The Rule #, followed by a :, and an echo of the rule should be dumped to stdout so that later traces that reference the rules can be followed. An acceptable simulator need not do any check that a character used in a transition is in Σ from line 2; if such a character is used in an input string, a branch to Trap is sufficient. Likewise, depending on your internal representation for the transition function, Line 3 (Q) need not be explicitly parsed and used. Also, if the machine file given to your simulator has multiple transitions from the same state with the same input symbol (i.e. an NFA transition), you may choose any approach as to what happens, and you do not need to error check that such transitions are in the file. Note also that this format was designed to allow interoperability of DFAs and FSTs (see Section 3.2.1). A dfa simulator when given an FST design will skip both line 3 (the FST output alphabet), and should ignore any fourth item on a transition line. 4

5 3.1.2 DFA Simulation Output When the simulator is processing an input line from the second file, it should output to stdout a trace of its execution as follows: At the start, the input string being processed, prefixed by String: For each transition, the following on a separate line: Step number, Rule Number, Initial State Name, Input Symbol, New State Name After all transitions have been performed, print either Accepted (if the last state was an accepting state) or Rejected (otherwise) The output should be compatible with a.csv form, allowing a redirect to a.csv file so that the output can be read by a spreadsheet program such as Excel. If there is a transition not defined in the machine file, you may assume the state to which the transition goes is the builtin Trap state. After the last line of strings in the input file has been processed, there should be a final line output that gives the number of lines processed, the number that were accepted, and the number rejected (rejection includes ending up in the built-in Trap state). This line will be used by the grader to check for correct execution of test cases Implementation on Arduino If your DFA is implemented on Arduino, there are several possible variations. The major one is how the machine file is input into the Arduino and processed by the sketch. Most likely, the file is actually read in by the host computer, and transferred to the Arduino via calls using the firmata library. This thus involves writing two programs: the Arduino sketch and some program in the host (this is why a single person team on Arduino need only do a DFA and not an FST). Within this option there are variations on how the parsing and processing of the file is performed. Doing it on the host means that a variety of libraries, such as Python s csv library considerably simplify coding. In contrast, the host side could simply read in the file, and send to the Arduino. The second major variation involves how the input string is input. Again, a host program could read the file, send a line at a time to the Arduino, and then receive the stream of output text. Alternatively, the Arduino monitor function could be used to allow the programmer to manually type in the string, and the output could go to the monitor (with an on-board LED representing the DFA being in an accepting state Instructor-Supplied Test Files Under the Projects tab of the class website kogge/courses/cse30151-sp18/index.html there is a directory called Project2. Within this directory there are several test files that can be used with dfa-team: Four different machine definition in both.txt and.csv formats: M1, M2, M3, Mystery. For the first three machines, sets of strings that should be accepted or rejected by the associated machines For the Mystery machine, a set of strings whose acceptance is unknown, and should be recorded so that the grader can determine if there is an issue. 3.2 FST An FST is a DFA where on each transition, a symbol from a second alphabet Γ is output. The second option program, to be named fst-team, where team is the name of your team, will simulate a FST. As with the DFA, it must take two files at input: an input machine file defining the DFA to be simulated, and an input file providing multiple character strings to run one at a time against the machine. In most cases, we would expect the code for this program to be a relatively straight-forward modification of that for the DFA FST Machine Format The format for an FST simulator is very similar to that for the DFA (Section 3.1.1), with only line 3 and lines 7 and beyond changing: 5

6 Line 3: Γ - the alphabet to be used as output. Again this is a comma-separated list, but may take up one of two forms (implementer choice): single ASCII letters, comma separated, as in a,b,c, comma-separated list of hexadecimal numbers, as in 0x12. Line 7 and beyond: δ - one transition rule per line, in a comma-separated format: Initial State Name, Input Symbol, New State Name, Output Symbol If there is no fourth item in a transition rule, then no output character should be generated. The Input Symbol is from Σ and Output Symbol is from Γ. Note that an FST design file given to a DFA simulator shall run correctly except that it will not output any characters FST Simulation Output The output of an FST should be again very similar to that of a DFA (Section 3.1.2), except for each transition the output character needs to be included. Further, at the end of processing a string, the output string should be printed Implementation on an Arduino An Arduino implementation of an FST is again very similar to that of a DFA (Section 3.1.3), with the extra requirement as to how to generate and display the output string. In particular, an Arduino implementation would ideally generate an output that drives discrete outputs to physical devices. In addition, it could be run in a mode where the input symbols are physical sensors, push buttons, etc. The hexadecimal option for Γ is particularly for Arduinos where the output may be a set of digital devices where binary codes drive what should happen. 3.3 NFA-to-DFA Translator This program option, to be called nfa2dfa-team, where team is the name of your team, should read in a machine file in the same format as for the DFA (Section 3.1.1), and produce an output file that represents a valid DFA version of the original input. It is expected that this original input file is for an NFA, that is, there may be either multiple transitions from the same state and same input symbol, and/or transitions with ɛ as the character. The output of your translator should be totally compatible with a DFA simulator as discussed ion Section 3.1, and should be demonstrated by running the output with appropriate test strings on that DFA simulator. The algorithm behind this program should resemble that of the book s Theorem In the same directory as the DFA test files (see Section 3.1.4), there are several NFA files that should be used as test files. After translation, these files should be run through the DFA to demonstrate their correctness. Also as with the DFA, each student in a collaborative team should generate their own NFA test machine and test strings, and verify that the output is correct. Given the nature of this program, it may be most efficient to write it to run on your host, and not your Arduino. Certainly, however, if you have an Arduino DFA, the output of this program should be a file that drives it directly. 3.4 Regex to NFA The final program option, to be named regex2nfa-team, where team is the name of your team, takes a string representing a regular expression, and using Lemma 1.55 from the book to construct an NFA. The output of this tool should be compatible with the nfa2dfa tool, which in turn should then run on a DFA simulator. All three programs then gives us the capability of writing a regular expression and then getting out a DFA which accepts it. For test programs, each student in the team shall develop a different regular expression, and verify that the output is correct. 6

7 Given the nature of this program, it may be most efficient to write it for your host, and not your Arduino. Certainly, however, if you have an Arduino DFA, the output of this program should be a file that feeds an nfa2dfa program which in turn drives the Arduino. 3.5 Student-supplied Test Cases In addition to instructor-supplied DFA and NFA machines and test program, each individual student shall create their own non-trivial test case for the highest program written by their team. For example a oneperson team who builds a dfa or fst must design at least one new DFA or FST. A two-person group that develops a nfa2dfa must then have each student develop their own NFA and show that it runs correctly through both programs. For a three-person team, each person must develop a separate non-trivial regex and show that it has been translated correctly through all three tools. These test cases should be included with the main code, and documented in each student s teamwork report (Section 4.2). The name field of each machine should thus include the netid of the student doing the design. 4 Documentation Two pieces of documentation, both in PDF format, are required. One (entitled readme-team.pdf) is submitted once by the entire team in the Sakai directory associated by one of the team members; the other teamwork-netid.pdf is submitted separately by each member of the team in their own directory 4.1 readme-team A key part of what your teams submit is a readme-team.pdf that includes the following in this order: 1. The members of the team. 2. Approximately how much time was spent in total on the project, and how much by each student. 3. A description of how you managed the code development and testing. Use of github in particular is a particularly strong suggestion to simplifying this process, as is some sort of organized code review. 4. The language you used, and a list of libraries you invoked. For Arduinos, using the online IDE allows you to save your code to the cloud, and then if there is a common signin, all team members can work with it. 5. A description of the key data structures you used, especially for the internal representation of states and the state machines and the transitions. 6. Observations made during the project. For example, if an nfa2dfa was written, a discussion of what you observed in expansion of machine description complexity from NFA to DFA. 7. A list of trace files that are also included that demonstrate correctness of your code. If you are running on an Arduino where dumping trace files might be difficult, you may request a demo with the instructor, and list in the documentation that such demos have been requested. 8. If you did any extra programs, or attempted any extra test cases, describe them separately. Only one member of the team need submit this report to their Sakai directory. 4.2 teamwork-netid In addition, each team member should prepare a brief discussion of their own personal view of the team dynamics, and stored in a PDF called teamwork-netid.pdf, where netid is your netid. The contents should include: 1. Who were the other team members. 2. Under whose netid is the readme-team.pdf, code, and other material saved. 3. How much time did you personally spend on the project, and what did you do? 4. Which machines did you design and how did you generate test strings? 5. What did you personally learn from the project, both about the topic, above programming and code development techniques, and about algorithms. 6. In your own words, how did the team dynamics work? What could be improved? (e.g. did you use github and if so did it help, did you meet frequently enough, etc.) 7

8 7. From your own perspective, what was the role of each team member, and did any member exceed expectations, or vice versa. Each student s submission here should be in their own words and SHOULD NOT be a copy of any other team members submission, nor should they be shared with the other team members. These reports will be kept private by the graders and instructor, and will be used to ensure healthy team dynamics. The instructor retains the right to adjust the score of an individual team member from the base score (both up and down) on the basis of these reports. Also, a composite of all such reports from all projects will be used to create an overall lessons learned at the end of the project in what techniques seemed to work better, and where problems arose. These hopefully will be of use for the next project. 5 Submission Each team member should have in their own Sakai directory for this course a directory called Project2, where all submissions should go. When the team is ready to submit, one (and only one) team member will place copies of all code at output in the designated common directory. Your non-arduino code should be runnable on any of the studentnn.cse.nd.edu machines so that if there is an issue the graders can run the code themselves. If you wrote in a compiled language like C++, include all needed source files (excepting standard libraries), a make file, and a compiled executable. The source code is there to allow the graders to look at the code for comments and to resolve any discrepancies that may arise in looking at your results. If you wrote in a language like Python make sure your code is compatible with one of the versions supported on the studentnn.cse.nd.edu machines, again to allow the graders to check something if there is an issue. If you developed code for an Arduino, include all sketches. Also in the same directory as the code the team should place an output trace file for each of the test files that you ran. The format should be as described in Section 3.1.2, and the name should be the same name as the test file but with a.csv. If you are running on an Arduino and have requested a physical demo, not so in your documentation, Section 4. In addition, every team member should include in their own Project2 Sakai directory a copy of their readme-team file, again in pdf. For the team members who did not upload code and readme s Machine and test files for the designs that the student did themselves. The output files from running the above machine files against the developed test files. A short readme describing what the machines are, what language they were supposed to accept, and whether or not the test set showed proper operation. 6 Grading Grading of the project will be based on a 100 points, divided up as the following Points off for late submissions (10 points per day). 5 points for following naming and submission conventions. 10 points for reasonably commented source code. 60 points for correctness of design as determined by the trace files. For 2-person teams, 30 points are used for each of the two programs; for 3 person teams, 20 points are allocated for each program. 10 points for completeness and quality of the readme file. 10 points for the student-designed machines and their tests. 5 points for the teamwork report. All but the last two items will be common to all members of a team. The last two are specific to each member. 8

9 6.1 Extra Credit If more than the required set of programs are developed by a team (especially a 1-person team such as developing a full FST on the Arduino rather than just a DFA), the extra work will be considered as Extra Credit and accounted for separately from the base project grade. All such extra credit work will be kept separate until final grades are assigned, with the value of the extra credit at the sole discretion of the instructor. In no case, however, will this extra credit exceed the equivalent of 20% of an entire project. 9

CSE Theory of Computing Spring 2018 Project 2-Finite Automata

CSE Theory of Computing Spring 2018 Project 2-Finite Automata CSE 30151 Theory of Computing Spring 2018 Project 2-Finite Automata Version 1 Contents 1 Overview 2 2 Valid Options 2 2.1 Project Options.................................. 2 2.2 Platform Options.................................

More information

CSE Theory of Computing Fall 2017 Project 2-Finite Automata

CSE Theory of Computing Fall 2017 Project 2-Finite Automata CSE 30151 Theory of Computing Fall 2017 Project 2-Finite Automata Version 1: Sept. 27, 2017 1 Overview The goal of this project is to have each student understand at a deep level the functioning of a finite

More information

CSE Theory of Computing Fall 2017 Project 3: K-tape Turing Machine

CSE Theory of Computing Fall 2017 Project 3: K-tape Turing Machine CSE 30151 Theory of Computing Fall 2017 Project 3: K-tape Turing Machine Version 1: Oct. 23, 2017 1 Overview The goal of this project is to have each student understand at a deep level the functioning

More information

CSE Theory of Computing Fall 2017 Project 1-SAT Solving

CSE Theory of Computing Fall 2017 Project 1-SAT Solving CSE 30151 Theory of Computing Fall 2017 Project 1-SAT Solving Version 3: Sept. 21, 2017 The purpose of this project is to gain an understanding of one of the most central problems of computing: Boolean

More information

CSE Theory of Computing Fall 2017 Project 4-Combinator Project

CSE Theory of Computing Fall 2017 Project 4-Combinator Project CSE 30151 Theory of Computing Fall 2017 Project 4-Combinator Project Version 1: Nov. 20, 2017 1 Overview At this point you understand computations that happen as planned series of individual steps where

More information

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1} CSE 5 Homework 2 Due: Monday October 6, 27 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in

More information

I have read and understand all of the instructions below, and I will obey the Academic Honor Code.

I have read and understand all of the instructions below, and I will obey the Academic Honor Code. Midterm Exam CS 341-451: Foundations of Computer Science II Fall 2014, elearning section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all

More information

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Theory of Computation Dr. Weiss Extra Practice Exam Solutions Name: of 7 Theory of Computation Dr. Weiss Extra Practice Exam Solutions Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try to be

More information

Programming Standards: You must conform to good programming/documentation standards. Some specifics:

Programming Standards: You must conform to good programming/documentation standards. Some specifics: CS3114 (Spring 2011) PROGRAMMING ASSIGNMENT #3 Due Thursday, April 7 @ 11:00 PM for 100 points Early bonus date: Wednesday, April 6 @ 11:00 PM for a 10 point bonus Initial Schedule due Thursday, March

More information

CS103 Handout 13 Fall 2012 May 4, 2012 Problem Set 5

CS103 Handout 13 Fall 2012 May 4, 2012 Problem Set 5 CS103 Handout 13 Fall 2012 May 4, 2012 Problem Set 5 This fifth problem set explores the regular languages, their properties, and their limits. This will be your first foray into computability theory,

More information

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all of

More information

CS 342 Software Design Spring 2018 Term Project Part III Saving and Restoring Exams and Exam Components

CS 342 Software Design Spring 2018 Term Project Part III Saving and Restoring Exams and Exam Components CS 342 Software Design Spring 2018 Term Project Part III Saving and Restoring Exams and Exam Components Due: Wednesday 13 March. Electronic copy due at 3:30 P.M. Optional paper copy may be handed in during

More information

NFAs and Myhill-Nerode. CS154 Chris Pollett Feb. 22, 2006.

NFAs and Myhill-Nerode. CS154 Chris Pollett Feb. 22, 2006. NFAs and Myhill-Nerode CS154 Chris Pollett Feb. 22, 2006. Outline Bonus Questions Equivalence with Finite Automata Myhill-Nerode Theorem. Bonus Questions These questions are open to anybody. I will only

More information

CS 536 Introduction to Programming Languages and Compilers Charles N. Fischer Lecture 5

CS 536 Introduction to Programming Languages and Compilers Charles N. Fischer Lecture 5 CS 536 Introduction to Programming Languages and Compilers Charles N. Fischer Lecture 5 CS 536 Spring 2015 1 Multi Character Lookahead We may allow finite automata to look beyond the next input character.

More information

COMP 412, Fall 2018 Lab 1: A Front End for ILOC

COMP 412, Fall 2018 Lab 1: A Front End for ILOC COMP 412, Lab 1: A Front End for ILOC Due date: Submit to: Friday, September 7, 2018 at 11:59 PM comp412code@rice.edu Please report suspected typographical errors to the class Piazza site. We will issue

More information

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA? R1 SET - 1 1. a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA? 2. a) Design a DFA that accepts the language over = {, 1} of all strings that

More information

Course Project 2 Regular Expressions

Course Project 2 Regular Expressions Course Project 2 Regular Expressions CSE 30151 Spring 2017 Version of February 16, 2017 In this project, you ll write a regular expression matcher similar to grep, called mere (for match and echo using

More information

CS 374 Fall 2014 Homework 2 Due Tuesday, September 16, 2014 at noon

CS 374 Fall 2014 Homework 2 Due Tuesday, September 16, 2014 at noon CS 374 Fall 2014 Homework 2 Due Tuesday, September 16, 2014 at noon Groups of up to three students may submit common solutions for each problem in this homework and in all future homeworks You are responsible

More information

CS2 Practical 2 CS2Ah

CS2 Practical 2 CS2Ah CS2 Practical 2 Finite automata This practical is based on material in the language processing thread. The practical is made up of two parts. Part A consists of four paper and pencil exercises, designed

More information

Lexical Analysis. Lecture 2-4

Lexical Analysis. Lecture 2-4 Lexical Analysis Lecture 2-4 Notes by G. Necula, with additions by P. Hilfinger Prof. Hilfinger CS 164 Lecture 2 1 Administrivia Moving to 60 Evans on Wednesday HW1 available Pyth manual available on line.

More information

CIS 505: Software Systems

CIS 505: Software Systems CIS 505: Software Systems Fall 2017 Assignment 3: Chat server Due on November 3rd, 2017, at 10:00pm EDT 1 Overview For this assignment, you will implement a simple replicated chat server that uses multicast

More information

Implementation of Lexical Analysis

Implementation of Lexical Analysis Implementation of Lexical Analysis Outline Specifying lexical structure using regular expressions Finite automata Deterministic Finite Automata (DFAs) Non-deterministic Finite Automata (NFAs) Implementation

More information

Lexical Analysis. Chapter 2

Lexical Analysis. Chapter 2 Lexical Analysis Chapter 2 1 Outline Informal sketch of lexical analysis Identifies tokens in input string Issues in lexical analysis Lookahead Ambiguities Specifying lexers Regular expressions Examples

More information

Lexical Analysis. Lecture 3-4

Lexical Analysis. Lecture 3-4 Lexical Analysis Lecture 3-4 Notes by G. Necula, with additions by P. Hilfinger Prof. Hilfinger CS 164 Lecture 3-4 1 Administrivia I suggest you start looking at Python (see link on class home page). Please

More information

Handout 9: Imperative Programs and State

Handout 9: Imperative Programs and State 06-02552 Princ. of Progr. Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 9: Imperative Programs and State Imperative

More information

CS 2604 Minor Project 1 DRAFT Fall 2000

CS 2604 Minor Project 1 DRAFT Fall 2000 RPN Calculator For this project, you will design and implement a simple integer calculator, which interprets reverse Polish notation (RPN) expressions. There is no graphical interface. Calculator input

More information

CS164: Programming Assignment 2 Dlex Lexer Generator and Decaf Lexer

CS164: Programming Assignment 2 Dlex Lexer Generator and Decaf Lexer CS164: Programming Assignment 2 Dlex Lexer Generator and Decaf Lexer Assigned: Thursday, September 16, 2004 Due: Tuesday, September 28, 2004, at 11:59pm September 16, 2004 1 Introduction Overview In this

More information

CS 342 Software Design Spring 2018 Term Project Part II Development of Question, Answer, and Exam Classes

CS 342 Software Design Spring 2018 Term Project Part II Development of Question, Answer, and Exam Classes CS 342 Software Design Spring 2018 Term Project Part II Development of Question, Answer, and Exam Classes Due: Wednesday 21 February. Electronic copy due at 3:30 P.M. Optional paper copy may be handed

More information

CS Lecture 2. The Front End. Lecture 2 Lexical Analysis

CS Lecture 2. The Front End. Lecture 2 Lexical Analysis CS 1622 Lecture 2 Lexical Analysis CS 1622 Lecture 2 1 Lecture 2 Review of last lecture and finish up overview The first compiler phase: lexical analysis Reading: Chapter 2 in text (by 1/18) CS 1622 Lecture

More information

Principles of Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore

Principles of Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore (Refer Slide Time: 00:20) Principles of Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore Lecture - 4 Lexical Analysis-Part-3 Welcome

More information

Midterm I (Solutions) CS164, Spring 2002

Midterm I (Solutions) CS164, Spring 2002 Midterm I (Solutions) CS164, Spring 2002 February 28, 2002 Please read all instructions (including these) carefully. There are 9 pages in this exam and 5 questions, each with multiple parts. Some questions

More information

14.1 Encoding for different models of computation

14.1 Encoding for different models of computation Lecture 14 Decidable languages In the previous lecture we discussed some examples of encoding schemes, through which various objects can be represented by strings over a given alphabet. We will begin this

More information

Implementation of Lexical Analysis

Implementation of Lexical Analysis Implementation of Lexical Analysis Outline Specifying lexical structure using regular expressions Finite automata Deterministic Finite Automata (DFAs) Non-deterministic Finite Automata (NFAs) Implementation

More information

Theory of Computations Spring 2016 Practice Final Exam Solutions

Theory of Computations Spring 2016 Practice Final Exam Solutions 1 of 8 Theory of Computations Spring 2016 Practice Final Exam Solutions Name: Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try

More information

Behaviour Diagrams UML

Behaviour Diagrams UML Behaviour Diagrams UML Behaviour Diagrams Structure Diagrams are used to describe the static composition of components (i.e., constraints on what intstances may exist at run-time). Interaction Diagrams

More information

Implementation of Lexical Analysis. Lecture 4

Implementation of Lexical Analysis. Lecture 4 Implementation of Lexical Analysis Lecture 4 1 Tips on Building Large Systems KISS (Keep It Simple, Stupid!) Don t optimize prematurely Design systems that can be tested It is easier to modify a working

More information

Lexical Analysis. COMP 524, Spring 2014 Bryan Ward

Lexical Analysis. COMP 524, Spring 2014 Bryan Ward Lexical Analysis COMP 524, Spring 2014 Bryan Ward Based in part on slides and notes by J. Erickson, S. Krishnan, B. Brandenburg, S. Olivier, A. Block and others The Big Picture Character Stream Scanner

More information

CS 2604 Minor Project 1 Summer 2000

CS 2604 Minor Project 1 Summer 2000 RPN Calculator For this project, you will design and implement a simple integer calculator, which interprets reverse Polish notation (RPN) expressions. There is no graphical interface. Calculator input

More information

CS103 Handout 14 Winter February 8, 2013 Problem Set 5

CS103 Handout 14 Winter February 8, 2013 Problem Set 5 CS103 Handout 14 Winter 2012-2013 February 8, 2013 Problem Set 5 This fifth problem set explores the regular languages, their properties, and their limits. This will be your first foray into computability

More information

Important Project Dates

Important Project Dates Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2002 Handout 4 Project Overview Wednesday, September 4 This is an overview of the course project

More information

Computation, Computers, and Programs. Administrivia. Resources. Course texts: Kozen: Introduction to Computability Hickey: Introduction to OCaml

Computation, Computers, and Programs. Administrivia. Resources. Course texts: Kozen: Introduction to Computability Hickey: Introduction to OCaml CS20a: Computation, Computers, Programs Instructor: Jason Hickey Email: jyh@cs.caltech.edu Office hours: TR 10-11am TAs: Nathan Gray (n8gray@cs.caltech.edu) Brian Aydemir (emre@cs.caltech.edu) Jason Frantz

More information

CSCI 204 Introduction to Computer Science II

CSCI 204 Introduction to Computer Science II CSCI 204 Project 2 Maze Assigned: Wednesday 09/27/2017 First Phase (Recursion) Due Friday, 10/06/2017 Second Phase (Stack) Due Monday, 10/16/2017 1 Objective The purpose of this assignment is to give you

More information

UNIT -2 LEXICAL ANALYSIS

UNIT -2 LEXICAL ANALYSIS OVER VIEW OF LEXICAL ANALYSIS UNIT -2 LEXICAL ANALYSIS o To identify the tokens we need some method of describing the possible tokens that can appear in the input stream. For this purpose we introduce

More information

Figure 2.1: Role of Lexical Analyzer

Figure 2.1: Role of Lexical Analyzer Chapter 2 Lexical Analysis Lexical analysis or scanning is the process which reads the stream of characters making up the source program from left-to-right and groups them into tokens. The lexical analyzer

More information

CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output

CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output Last revised January 12, 2006 Objectives: 1. To introduce arithmetic operators and expressions 2. To introduce variables

More information

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions Last lecture CMSC330 Finite Automata Languages Sets of strings Operations on languages Regular expressions Constants Operators Precedence 1 2 Finite automata States Transitions Examples Types This lecture

More information

Introduction to Lexical Analysis

Introduction to Lexical Analysis Introduction to Lexical Analysis Outline Informal sketch of lexical analysis Identifies tokens in input string Issues in lexical analysis Lookahead Ambiguities Specifying lexical analyzers (lexers) Regular

More information

CS 2704 Project 2: Elevator Simulation Fall 1999

CS 2704 Project 2: Elevator Simulation Fall 1999 Elevator Simulation Consider an elevator system, similar to the one on McBryde Hall. At any given time, there may be zero or more elevators in operation. Each operating elevator will be on a particular

More information

3. When you process a largest recent earthquake query, you should print out:

3. When you process a largest recent earthquake query, you should print out: CS3114 (Fall 2013) PROGRAMMING ASSIGNMENT #1 Due Wednesday, September 18 @ 11:00 PM for 100 points Due Tuesday, September 17 @ 11:00 PM for 10 point bonus Updated: 9/11/2013 Assignment: This is the first

More information

Translator Design CRN Test 3 Revision 1 CMSC 4173 Spring 2012

Translator Design CRN Test 3 Revision 1 CMSC 4173 Spring 2012 Name: Student ID: E-Mail: Course CMSC 4173, Translator Design CRN: 24414, Spring, 2012 Date: Thursday, May 3, 2012 at 5:30 p.m. Instructions: 1. Type your name in the space provided. 2. Type your student

More information

1. [5 points each] True or False. If the question is currently open, write O or Open.

1. [5 points each] True or False. If the question is currently open, write O or Open. University of Nevada, Las Vegas Computer Science 456/656 Spring 2018 Practice for the Final on May 9, 2018 The entire examination is 775 points. The real final will be much shorter. Name: No books, notes,

More information

User s Guide: JFLAP Finite Automata Feedback/Grading Tool

User s Guide: JFLAP Finite Automata Feedback/Grading Tool User s Guide: JFLAP Finite Automata Feedback/Grading Tool Daphne A. Norton dan0337@cs.rit.edu February 14, 2008 1 Preface This tool is intended for use with JFLAP, the Java Formal Language and Automata

More information

Midterm Exam. CSCI 3136: Principles of Programming Languages. February 20, Group 2

Midterm Exam. CSCI 3136: Principles of Programming Languages. February 20, Group 2 Banner number: Name: Midterm Exam CSCI 336: Principles of Programming Languages February 2, 23 Group Group 2 Group 3 Question. Question 2. Question 3. Question.2 Question 2.2 Question 3.2 Question.3 Question

More information

CS/ECE 374 Fall Homework 1. Due Tuesday, September 6, 2016 at 8pm

CS/ECE 374 Fall Homework 1. Due Tuesday, September 6, 2016 at 8pm CSECE 374 Fall 2016 Homework 1 Due Tuesday, September 6, 2016 at 8pm Starting with this homework, groups of up to three people can submit joint solutions. Each problem should be submitted by exactly one

More information

Optimizing Finite Automata

Optimizing Finite Automata Optimizing Finite Automata We can improve the DFA created by MakeDeterministic. Sometimes a DFA will have more states than necessary. For every DFA there is a unique smallest equivalent DFA (fewest states

More information

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

6.080 / Great Ideas in Theoretical Computer Science Spring 2008 MIT OpenCourseWare http://ocw.mit.edu 6.8 / 6.89 Great Ideas in Theoretical Computer Science Spring 28 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

More information

University of Waterloo Midterm Examination

University of Waterloo Midterm Examination University of Waterloo Midterm Examination 1 Fall 2008 Student Name: UW Student ID Number: UW Userid: Course Abbreviation and Number: CS 241 Course Title: Foundations of Sequential Programs Section(s):

More information

Compilers. Computer Science 431

Compilers. Computer Science 431 Compilers Computer Science 431 Instructor: Erik Krohn E-mail: krohne@uwosh.edu Text Message Only: 608-492-1106 Class Time: Tuesday & Thursday: 9:40am - 11:10am Classroom: Halsey 237 Office Location: Halsey

More information

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS Objective PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS Explain what is meant by compiler. Explain how the compiler works. Describe various analysis of the source program. Describe the

More information

CMSC 350: COMPILER DESIGN

CMSC 350: COMPILER DESIGN Lecture 11 CMSC 350: COMPILER DESIGN see HW3 LLVMLITE SPECIFICATION Eisenberg CMSC 350: Compilers 2 Discussion: Defining a Language Premise: programming languages are purely formal objects We (as language

More information

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur Finite Automata Dr. Nadeem Akhtar Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur PhD Laboratory IRISA-UBS University of South Brittany European University

More information

Overview. Lab 5: Collaborative Filtering and Recommender Systems. Assignment Preparation. Data

Overview. Lab 5: Collaborative Filtering and Recommender Systems. Assignment Preparation. Data .. Spring 2009 CSC 466: Knowledge Discovery from Data Alexander Dekhtyar.. Lab 5: Collaborative Filtering and Recommender Systems Due date: Wednesday, November 10. Overview In this assignment you will

More information

Compiler course. Chapter 3 Lexical Analysis

Compiler course. Chapter 3 Lexical Analysis Compiler course Chapter 3 Lexical Analysis 1 A. A. Pourhaji Kazem, Spring 2009 Outline Role of lexical analyzer Specification of tokens Recognition of tokens Lexical analyzer generator Finite automata

More information

CSCI 2321 (Computer Design), Spring 2018 Homework 3

CSCI 2321 (Computer Design), Spring 2018 Homework 3 CSCI 2321 (Computer Design), Spring 2018 Homework 3 Credit: 50 points. 1 Reading Be sure you have read, or at least skimmed, all assigned sections of Chapter 2 and Appendix A. 2 Honor Code Statement Please

More information

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM Name: Student ID: Signature: Section (circle one): George Steve Your signature acknowledges your understanding of and agreement

More information

Reading 1 : Introduction

Reading 1 : Introduction CS/Math 240: Introduction to Discrete Mathematics Fall 2015 Instructors: Beck Hasti and Gautam Prakriya Reading 1 : Introduction Welcome to CS 240, an introduction to discrete mathematics. This reading

More information

Definition 2.8: A CFG is in Chomsky normal form if every rule. only appear on the left-hand side, we allow the rule S ǫ.

Definition 2.8: A CFG is in Chomsky normal form if every rule. only appear on the left-hand side, we allow the rule S ǫ. CS533 Class 02b: 1 c P. Heeman, 2017 CNF Pushdown Automata Definition Equivalence Overview CS533 Class 02b: 2 c P. Heeman, 2017 Chomsky Normal Form Definition 2.8: A CFG is in Chomsky normal form if every

More information

The Language for Specifying Lexical Analyzer

The Language for Specifying Lexical Analyzer The Language for Specifying Lexical Analyzer We shall now study how to build a lexical analyzer from a specification of tokens in the form of a list of regular expressions The discussion centers around

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design i About the Tutorial A compiler translates the codes written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target

More information

CS3114 (Fall 2013) PROGRAMMING ASSIGNMENT #2 Due Tuesday, October 11:00 PM for 100 points Due Monday, October 11:00 PM for 10 point bonus

CS3114 (Fall 2013) PROGRAMMING ASSIGNMENT #2 Due Tuesday, October 11:00 PM for 100 points Due Monday, October 11:00 PM for 10 point bonus CS3114 (Fall 2013) PROGRAMMING ASSIGNMENT #2 Due Tuesday, October 15 @ 11:00 PM for 100 points Due Monday, October 14 @ 11:00 PM for 10 point bonus Updated: 10/10/2013 Assignment: This project continues

More information

Guide to Supplemental Materials

Guide to Supplemental Materials Guide to Supplemental Materials October 7, 2017 A submitted manuscript should stand on its own, i.e., it should make a sound presentation of the rationale, research questions, and methods and data analyses,

More information

Comparing and Contrasting different Approaches of Code Generator(Enum,Map-Like,If-else,Graph)

Comparing and Contrasting different Approaches of Code Generator(Enum,Map-Like,If-else,Graph) Comparing and Contrasting different Approaches of Generator(Enum,Map-Like,If-else,Graph) Vivek Tripathi 1 Sandeep kumar Gonnade 2 Mtech Scholar 1 Asst.Professor 2 Department of Computer Science & Engineering,

More information

FACULTY OF ENGINEERING LAB SHEET INFORMATION THEORY AND ERROR CODING ETM 2126 ETN2126 TRIMESTER 2 (2011/2012)

FACULTY OF ENGINEERING LAB SHEET INFORMATION THEORY AND ERROR CODING ETM 2126 ETN2126 TRIMESTER 2 (2011/2012) FACULTY OF ENGINEERING LAB SHEET INFORMATION THEORY AND ERROR CODING ETM 2126 ETN2126 TRIMESTER 2 (2011/2012) Experiment 1: IT1 Huffman Coding Note: Students are advised to read through this lab sheet

More information

CS 241 Data Organization. August 21, 2018

CS 241 Data Organization. August 21, 2018 CS 241 Data Organization August 21, 2018 Contact Info Instructor: Dr. Marie Vasek Contact: Private message me on the course Piazza page. Office: Room 2120 of Farris Web site: www.cs.unm.edu/~vasek/cs241/

More information

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.

Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table. Code No: XXXXX JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD B.Tech II Year I Semester Examinations (Common to CSE and IT) Note: This question paper contains two parts A and B. Part A is compulsory

More information

Regular Languages and Regular Expressions

Regular Languages and Regular Expressions Regular Languages and Regular Expressions According to our definition, a language is regular if there exists a finite state automaton that accepts it. Therefore every regular language can be described

More information

Finite automata. We have looked at using Lex to build a scanner on the basis of regular expressions.

Finite automata. We have looked at using Lex to build a scanner on the basis of regular expressions. Finite automata We have looked at using Lex to build a scanner on the basis of regular expressions. Now we begin to consider the results from automata theory that make Lex possible. Recall: An alphabet

More information

ECS 120 Lesson 16 Turing Machines, Pt. 2

ECS 120 Lesson 16 Turing Machines, Pt. 2 ECS 120 Lesson 16 Turing Machines, Pt. 2 Oliver Kreylos Friday, May 4th, 2001 In the last lesson, we looked at Turing Machines, their differences to finite state machines and pushdown automata, and their

More information

CS 361 Computer Systems Fall 2017 Homework Assignment 1 Linking - From Source Code to Executable Binary

CS 361 Computer Systems Fall 2017 Homework Assignment 1 Linking - From Source Code to Executable Binary CS 361 Computer Systems Fall 2017 Homework Assignment 1 Linking - From Source Code to Executable Binary Due: Thursday 14 Sept. Electronic copy due at 9:00 A.M., optional paper copy may be delivered to

More information

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and Computer Language Theory Chapter 4: Decidability 1 Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

More information

13 th Annual Johns Hopkins Math Tournament Saturday, February 18, 2012 Explorations Unlimited Round Automata Theory

13 th Annual Johns Hopkins Math Tournament Saturday, February 18, 2012 Explorations Unlimited Round Automata Theory 13 th Annual Johns Hopkins Math Tournament Saturday, February 18, 2012 Explorations Unlimited Round Automata Theory 1. Introduction Automata theory is an investigation of the intersection of mathematics,

More information

CS402 - Theory of Automata Glossary By

CS402 - Theory of Automata Glossary By CS402 - Theory of Automata Glossary By Acyclic Graph : A directed graph is said to be acyclic if it contains no cycles. Algorithm : A detailed and unambiguous sequence of instructions that describes how

More information

6 NFA and Regular Expressions

6 NFA and Regular Expressions Formal Language and Automata Theory: CS21004 6 NFA and Regular Expressions 6.1 Nondeterministic Finite Automata A nondeterministic finite automata (NFA) is a 5-tuple where 1. is a finite set of states

More information

Chapter 3 Lexical Analysis

Chapter 3 Lexical Analysis Chapter 3 Lexical Analysis Outline Role of lexical analyzer Specification of tokens Recognition of tokens Lexical analyzer generator Finite automata Design of lexical analyzer generator The role of lexical

More information

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016 University of Nevada, Las Vegas Computer Science 456/656 Fall 2016 The entire examination is 925 points. The real final will be much shorter. Name: No books, notes, scratch paper, or calculators. Use pen

More information

ECS 120 Lesson 7 Regular Expressions, Pt. 1

ECS 120 Lesson 7 Regular Expressions, Pt. 1 ECS 120 Lesson 7 Regular Expressions, Pt. 1 Oliver Kreylos Friday, April 13th, 2001 1 Outline Thus far, we have been discussing one way to specify a (regular) language: Giving a machine that reads a word

More information

CS 241 Data Organization using C

CS 241 Data Organization using C CS 241 Data Organization using C Fall 2018 Instructor Name: Dr. Marie Vasek Contact: Private message me on the course Piazza page. Office: Farris 2120 Office Hours: Tuesday 2-4pm and Thursday 9:30-11am

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2018 http://cseweb.ucsd.edu/classes/sp18/cse105-ab/ Today's learning goals Sipser Section 2.2 Define push-down automata informally and formally Trace the computation

More information

2 Steps Building the Coding and Testing Infrastructure

2 Steps Building the Coding and Testing Infrastructure CSI 333 Prog. HW/SW Interface Projects 5 Spring 2007 Professor Chaiken Simple Recursive Regular Expression Matcher in ASM Due: Oct 23 and Oct 30 (see below) The numbered items specify what will be graded

More information

CS ) PROGRAMMING ASSIGNMENT 11:00 PM 11:00 PM

CS ) PROGRAMMING ASSIGNMENT 11:00 PM 11:00 PM CS3114 (Fall 2017) PROGRAMMING ASSIGNMENT #4 Due Thursday, December 7 th @ 11:00 PM for 100 points Due Tuesday, December 5 th @ 11:00 PM for 10 point bonus Last updated: 11/13/2017 Assignment: Update:

More information

Chapter 2 - Programming Language Syntax. September 20, 2017

Chapter 2 - Programming Language Syntax. September 20, 2017 Chapter 2 - Programming Language Syntax September 20, 2017 Specifying Syntax: Regular expressions and context-free grammars Regular expressions are formed by the use of three mechanisms Concatenation Alternation

More information

CS 385 Operating Systems Fall 2011 Homework Assignment 4 Simulation of a Memory Paging System

CS 385 Operating Systems Fall 2011 Homework Assignment 4 Simulation of a Memory Paging System CS 385 Operating Systems Fall 2011 Homework Assignment 4 Simulation of a Memory Paging System Due: Tuesday November 15th. Electronic copy due at 2:30, optional paper copy at the beginning of class. Overall

More information

Mathematics Mathematics Applied mathematics Mathematics

Mathematics Mathematics Applied mathematics Mathematics Mathematics Mathematics is the mother of science. It applies the principles of physics and natural sciences for analysis, design, manufacturing and maintenance of systems. Mathematicians seek out patterns

More information

Lecture 2 Finite Automata

Lecture 2 Finite Automata Lecture 2 Finite Automata August 31, 2007 This lecture is intended as a kind of road map to Chapter 1 of the text just the informal examples that I ll present to motivate the ideas. 1 Expressions without

More information

CS112 Lecture: Working with Numbers

CS112 Lecture: Working with Numbers CS112 Lecture: Working with Numbers Last revised January 30, 2008 Objectives: 1. To introduce arithmetic operators and expressions 2. To expand on accessor methods 3. To expand on variables, declarations

More information

CSE 5317 Midterm Examination 4 March Solutions

CSE 5317 Midterm Examination 4 March Solutions CSE 5317 Midterm Examination 4 March 2010 1. / [20 pts] Solutions (parts a j; -1 point for each wrong answer, 0 points for each blank answer, 2 point for each correct answer. Therefore, the score for this

More information

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG) CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG) Objectives Introduce Pushdown Automaton (PDA) Show that PDA = CFG In terms of descriptive power Pushdown Automaton (PDA) Roughly

More information

CSE450. Translation of Programming Languages. Lecture 20: Automata and Regular Expressions

CSE450. Translation of Programming Languages. Lecture 20: Automata and Regular Expressions CSE45 Translation of Programming Languages Lecture 2: Automata and Regular Expressions Finite Automata Regular Expression = Specification Finite Automata = Implementation A finite automaton consists of:

More information

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; }

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; } Ex: The difference between Compiler and Interpreter The interpreter actually carries out the computations specified in the source program. In other words, the output of a compiler is a program, whereas

More information

Qualifying Exam Theory

Qualifying Exam Theory Theory This exam contains 8 problems, some with multiple parts. (including 2 blank pages). There are 11 pages to the exam Write your solutions in the space provided. If you need more space, write on the

More information