コード例 #1
0
ファイル: main.cpp プロジェクト: kharland/NFAToDFA
/* Main Implementation -------------------------------------------------------*/
int main( int argc, char *argv[] )
{
    if (argc == 2 && strcmp(argv[1], "--help") == 0) {
        std::cout << "Input Format:\n\n"
        << "Initial State: {3}\n"
        << "Final States:  {12,...}\n"
        << "Total States:  15\n"
        << "State    a     b     E\n"
        << "1      {...} {...} {...}\n"
        << "...    ...\n";
        exit(0);
    }

    int initState=0, totalStates=0;
    std::vector<int> finalStates;
    std::string alphabet;

    scanf("Initial State: {%d}\n", &initState); // read initial state
    read_final_states(&finalStates);            // read final states 
    scanf("Total States: %d\n", &totalStates);  // read total no. of states
    read_alphabet(&alphabet);                   // read alphabet

    // Create NFA in memory and read transition table from stdin
    Automata fa(alphabet, initState-1, totalStates, finalStates);
    read_automata(&fa);

    // Convert to dfa
    convert_nfa_dfa(&fa);
    fa.Print();

    return 0;
}
コード例 #2
0
ファイル: tp01.c プロジェクト: renvieir/ftc
//########################## Functions Body ##########################
int main()
{
    // main variables
    Tnode *states;
    char *alphabet;
    int nstates,nalphabet;

    // read states
    states = (Tnode *) malloc (sizeof(Tnode));   
    read_states(states, &nstates);    

    // read alphabet
    alphabet = (char *) malloc (sizeof(char));
    read_alphabet(alphabet, &nalphabet);    

    print(states, nstates, alphabet, nalphabet);

    // TODO: read transitions
    read_transitions();
    
    // TODO: read initial and final states
    
    // TODO: read words to recognize
}