Write C, C + + or Python jobs, write Linux environment under programming C, C + + or Python job generation

Source: Internet
Author: User

Implement a DFA simulator (in C, C + + or Python) in a Linux environment:
? Read in a specified machine (5-tuple definition) and process input strings against this DFA;
Output ACCEPT or not is accept for each input string.
? All error checking must is performed including command line argument parsing, valid
Definition file, valid input string etc.
? Full help usage must is provided which should is self sufficient to run the program.
? Input string is read from stdin which means following should work
?./dfa-d M1.dfa <m1.in
?./dfa-d M1.dfa <m1.in >m1.out
? Cat m1.in |./dfa-d M1.DFA
? -v option should provide verbose information on the working of the machine; For example
Display the definition of the machine, transitions as input is processed etc.
Deliverables
? Source files
? Sample Input/output
? Define 3 machines:1.6 B, C, F [homework #2] and show at least 3 ACCEPT and 3 not
ACCEPT examples for each.
? Define machine for A*.c-as do in class; Show at least 3 accept and 3 not accept
Examples
? You can show other examples too.
? 1 page Report:write about issues faced, lessons learned, any remaining bugs etc.
? Create a directory FIRSTNAME.LASTNAME/PN where n is the assignment number and store all the
Files in this directory.
Extra Credit
? [3 points] in additon, support JSON definition for machine; Read machine defined in JSON; Also
Output JSON for machine definition in verbose mode;
? [7.5 points] implement NFA with the same functionality.
? [7.5 points] implement in another Language-python or C + + or C
? [5 points] show visualization and draw the machine
? Think of other command line options which could is useful.
? Any other functionality .... –please document in report and code.
Deadline and late submissions
? The assignment is due on the date specified above at 11:59:59 PM
? Each day late would incur a penalty of 5% of the grade for the assignment; For example, if the
Assignment is 3 days late, the maximum grade would
Be-out of 100-15 'll be subtracted
From whatever grade is assigned.
Sample Run
[The sample output below is my implementation and is provided as a reference;
Change/improve this if you implement.
Usage:
./dfa-h-D <dfafile>-V
A simple DFA implementation. The DFA definition
is specified via. DFA file; Input string is the read from stdin.
In Non-verbose mode, print accept or not accept as the.
-H
Print usage
-D <dfafile>
DFA definition File
-V
Verbose mode; Display machine definition, transitions etc.
Example:
./dfa-d M1.DFA
Example DFA Definition File M1.dfa
# DFA M1 from Page to ITC Text;
STATES:Q1 Q2 Q3
alphabet:0 1
Startstate:q1
Finalstate:q2
TRANSITION:Q1 0 Q1
TRANSITION:Q1 1 Q2
TRANSITION:Q2 0 Q3
TRANSITION:Q2 1 Q2
TRANSITION:Q3 0 Q2
TRANSITION:Q3 1 Q2
Example run in interactive mode:
$./dfa-d M1.DFA
00011
00011-To-ACCEPT
00100
00100-To-ACCEPT
00000
00000 to not ACCEPT
00000 to not ACCEPT
Interactive Run:
$./dfa-d M1.DFA
00000
00000 to not ACCEPT
11111
11111-To-ACCEPT
01010
01010 to not ACCEPT
00100
00100-To-ACCEPT
00201
Invalid Alphabet:2; Ignoring rest of input
00201 to not ACCEPT
11100
11100-To-ACCEPT
00a11
Invalid alphabet:a; Ignoring rest of input
00a11 to not ACCEPT
110011
110011-To-ACCEPT
110011-To-ACCEPT
Use of the Pipe and redirection for input:
$ cat M1.in
00000
11111
00100
001001
001000
0010001
$ Cat m1.in |./dfa-d M1.DFA
00000 to not ACCEPT
11111-To-ACCEPT
00100-To-ACCEPT
001001-To-ACCEPT
001000 to not ACCEPT
0010001-To-ACCEPT
0010001-To-ACCEPT
$./dfa-d M1.dfa <m1.in
00000 to not ACCEPT
11111-To-ACCEPT
00100-To-ACCEPT
001001-To-ACCEPT
001000 to not ACCEPT
0010001-To-ACCEPT
0010001-To-ACCEPT
Interactive Run with-v Flag:
$./dfa-d M1.dfa-v
---BEGIN DFA definition---
States:
Q1 Q2 Q3
Alphabet:
0 1
Startstate:q1
Finalstate:
Q2
Transitions:
Q1 0 Q1
Q1 1 Q2
Q2 0 Q3
Q2 1 Q2
Q3 0 Q2
Q3 1 Q2
---END DFA definition---
001100
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:1-New state:q2
Current STATE:Q2 symbol:1-New state:q2
Current STATE:Q2 symbol:0-New state:q3
Current STATE:Q3 symbol:0-New state:q2
001100-To-ACCEPT
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:1-New state:q2
Current STATE:Q2 symbol:1-New state:q2
Current STATE:Q2 symbol:0-New state:q3
Current STATE:Q3 symbol:0-New state:q2
001100-To-ACCEPT
Use of Pipe and redirection for input WITH-V flag:
$./dfa-d m1.dfa-v <m1.in >m1.out
$
$ cat M1.out
---BEGIN DFA definition---
States:
Q1 Q2 Q3
Alphabet:
0 1
Startstate:q1
Finalstate:
Q2
Transitions:
Q1 0 Q1
Q1 1 Q2
Q2 0 Q3
Q2 1 Q2
Q3 0 Q2
Q3 1 Q2
---END DFA definition---
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:0-New state:q1
00000 to not ACCEPT
Current STATE:Q1 symbol:1-New state:q2
Current STATE:Q2 symbol:1-New state:q2
Current STATE:Q2 symbol:1-New state:q2
Current STATE:Q2 symbol:1-New state:q2
Current STATE:Q2 symbol:1-New state:q2
11111-To-ACCEPT
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:1-New state:q2
Current STATE:Q2 symbol:0-New state:q3
Current STATE:Q3 symbol:0-New state:q2
00100-To-ACCEPT
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:1-New state:q2
Current STATE:Q2 symbol:0-New state:q3
Current STATE:Q3 symbol:0-New state:q2
Current STATE:Q2 symbol:1-New state:q2
001001-To-ACCEPT
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:1-New state:q2
Current STATE:Q2 symbol:0-New state:q3
Current STATE:Q3 symbol:0-New state:q2
Current STATE:Q2 symbol:0-New state:q3
001000 to not ACCEPT
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:1-New state:q2
Current STATE:Q2 symbol:0-New state:q3
Current STATE:Q3 symbol:0-New state:q2
Current STATE:Q2 symbol:0-New state:q3
Current STATE:Q3 symbol:1-New state:q2
0010001-To-ACCEPT

The core staff of the team mainly include Silicon Valley engineers, bat front-line engineers, domestic TOP5 master, PhD students, proficient in German English! Our main business scope is to do programming big homework, curriculum design and so on.

Our Direction field: Window Programming numerical algorithm AI Artificial Intelligence financial statistical Metrology analysis Big Data network programming Web programming Communication Programming game Programming Multimedia Linux plug-in programming API image processing embedded/Microcontroller database programming console process and thread Network security assembly language Hardware programming software Design Engineering Standard Rules. The generation of programming languages or tools including, but not limited to, the following ranges:

C/c++/c# Write

Java Write generation

It generation

Python writes

Tutoring Programming Jobs

The MATLAB Generation writes

Haskell writes

Processing Write

Linux Environment Setup

Rust Generation Write

Data Structure assginment Data structure generation

MIPS Generation Writing

Machine Learning Job Writing

Oracle/sql/postgresql/pig database Generation/Generation/Coaching

Web development, Web development, Web site jobs

Asp. NET Web site development

Finance insurace Statistics Statistics, regression, iteration

Prolog write

Computer Computational Method Generation

Because of professional, so trustworthy. If necessary, please add qq:99515681 or e-mail:[email protected] : Codinghelp


Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:0-New state:q1
Current STATE:Q1 symbol:1-New state:q2
Current STATE:Q2 symbol:0-New state:q3
Current STATE:Q3 symbol:0-New state:q2
Current STATE:Q2 symbol:0-New state:q3
Current STATE:Q3 symbol:1-New state:q2
0010001-To-ACCEPT
Http://www.daixie0.com/contents/3/1233.html

Write C, C + + or Python jobs, write Linux environment under programming C, C + + or Python job generation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.