Thread: program to read in a deterministic finite automata from a file

  1. #1
    Registered User
    Join Date
    Sep 2006
    Location
    vancouver wa
    Posts
    221

    program to read in a deterministic finite automata from a file

    Alright, i have no idea on how to start this. I am trying to write a program that reads in a deterministic finite automata followed by one or more strings. This program should run each of the input strings through the automata and output if the string is part of the language defined by the automata.

    The input is a text file. The format of the file is as follows:

    comment
    number of states
    starting state, input symbol, next state

    final states – on same line
    strings



    file:

    Code:
    ‘Ends in a
    2
    S, a, A
    S, b, S
    A, a, A
    A, b, S
    F: A
    aba
    bbaabba
    bbabab
    aaaab
    b
    a
    The machine will begin in the state listed with the first transition. In this example ‘S’. The final states will be listed at the end of the automata and marked with ‘F:’ (F will never be a state).

    Following the final state will be the list of strings to run through the machine.

    Code:
    aba
    bbaabba
    bbabab
    aaaab
    b
    a
    I have no code to show because i dont know how to start this. Do i read the whole contents into a data structure of some sort? Then, loop to check for alpha, upper case / lower?

    whats got me puzzled in the deterministic finite automata is defined in a file. Should i use a delimitier like comma newline and space to break up the file contents? Can someone help?
    Last edited by mrsirpoopsalot; 10-14-2011 at 07:39 PM.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Location
    vancouver wa
    Posts
    221
    No one an help me?

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Worry about reading your file first, and storing what it has. Then worry about doing stuff based on what you've got stored.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Basic file read, file write program
    By starwarsyeah in forum C++ Programming
    Replies: 5
    Last Post: 02-28-2011, 03:23 PM
  2. Deterministic finite automata programming
    By sholex in forum C++ Programming
    Replies: 3
    Last Post: 12-18-2010, 01:45 PM
  3. Simple File Read Program...
    By PowerHouse in forum C Programming
    Replies: 9
    Last Post: 10-07-2008, 11:30 PM
  4. Read data from file - C program ?
    By Pawan Sangal in forum C Programming
    Replies: 2
    Last Post: 08-22-2008, 04:28 AM
  5. My program can't read an internet file!
    By Queatrix in forum Windows Programming
    Replies: 3
    Last Post: 05-06-2005, 04:25 PM