Jump to content

turing machine

- - - - -

  • Please log in to reply
15 replies to this topic

#1
dole

dole

    Newbie

  • Members
  • Pip
  • 9 posts
hi

i got the assignment to do a program that builds grammar L(G) = L(M) for assigned turing machine.
well i am well over my head, and i dont even know where to begin. i know little bout turing machine theory and could possibly implement some easier turing, but this...

so i am asking for any kind of help (i am somewhat hoping to find a good soul who could do this for me, but any kind of help is welcome).

#2
bobdark

bobdark

    Programmer

  • Members
  • PipPipPipPip
  • 164 posts
let me get it right - the input to your program is a turing machine?
What can you assume about this turing machine? Does it halt for every input? How do you interpret the input? I mean, how do you decode the input to get the machine?
Anything you can assume on its language?

#3
dole

dole

    Newbie

  • Members
  • Pip
  • 9 posts
well i find the assignment formulated little weird. that is one of the problems why it is kinda hard.
full text of the assignment goes like this:
implement on computer program that will for assigned turing machine build corresponding grammar (L(G) = L(M))

#4
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,717 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
This is really vague. Do they want a full-out C/C++ implementation, or just pseudocode?
sudo rm -rf /

#5
dole

dole

    Newbie

  • Members
  • Pip
  • 9 posts

dargueta said:

This is really vague. Do they want a full-out C/C++ implementation, or just pseudocode?
they want full implementation (doesnt need to be C/C++, but it is the language i know most, so C :) ).

i got information from a friend that i should implement it something like this:
Turing Machine To Unrestricted Grammar

so i think it will need to accept any turing(probably transitions in an input file) and convert it to unrestricted grammar. at least now i know what to do :)

btw if someone has seen or has source of smth like this pls post it here.

#6
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,717 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Start by defining an input format for your Turing machine description. It shouldn't be more than two or three sentences, by my count.
sudo rm -rf /

#7
dole

dole

    Newbie

  • Members
  • Pip
  • 9 posts
well i have previously made a turing machine that multiplies 2 numbers, so i will use struct from there (cause it already has a parser) or smth similar to it, so it will accept turing transitions smth like this:
(q0, a)=>(q1, b, R)

q0->current state

a->input sign

q1->new state

b->replacing the input sign

R->shift to the right

now i found what i think is the correct alghorithm on the net
http://www.cs.usfca....1/lecture13.pdf
from 13-49 i think it reffers to my assignment. from what i see i need to do turing simulator in reverse.

well i g2g now, so i will post few questions later...

#8
dole

dole

    Newbie

  • Members
  • Pip
  • 9 posts
argh... the more i read the more i become confused... dont know right from wrong now... sometimes too much material harms you..

can someone explain to me in plain words how will i from transitions in above link get grammar. here is example
(q0,a),(q1,->) transition gets you
aaQ1->aQ0a
abQ1->aQ0b
auQ1->aQ0u

and what does -> in transition mean? shift to the right? or arrow in grammar production?

#9
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,717 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Your transitions are incomplete. Turing machine transitions are quintuples, namely:

(current state, symbol under read head) --> (Next state, symbol to write, direction to move head).
sudo rm -rf /

#10
dole

dole

    Newbie

  • Members
  • Pip
  • 9 posts
yeah i know that, but in the link they are like that. probably cause state represents nonterminal sign, so it should be (q0,a),(q1,q1,->), so it probably doesnt matter, if you write it that way...

#11
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,717 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
I dunno. Not the way I learned it, but there's a lot of ways to kill a cow.
sudo rm -rf /

#12
dole

dole

    Newbie

  • Members
  • Pip
  • 9 posts
yeah i know.. .well i am thinking of a new solution.. cant get it in my head cause i didnt see any source that has turing and grammar in it. all i have are tons of pages of theoretical alghorithms, but not one implementation (and i hate theory).




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users