Find Jobs
Hire Freelancers

Type 0 Grammar

$10-30 USD

Chiuso
Pubblicato più di 6 anni fa

$10-30 USD

Pagato al completamento
Define a type 0 grammar that simulates a Turing Machine computation to accept the language (w w | w ∊ (0 + 1)*} The calculation can be done in three stages: For example, on input 10111011 Stage 1: Place an end marker at each end of the string: $10111011$ Stage 2: Move the end markers inward till they meet in the middle and mark the middle: 1011x1011 Stage 3: Go back and forth matching and crossing off symbols of the two strings. See the example grammar that accepts palindromes. To use the Python program: step 1: Click Rules and load a grammar rules file. Step 2: Click Run to initialize and run the simulation. When the program is paused, the step button can be used to run one step at a time. The simulation ends when no applicable re-writing rule is found. If at the end of the calculation the string contains non-terminals (capital letters), the input is rejected. If there are no uppercase letters the string is accepted. (Note, this is not exactly true. I took the quick approach and just checked islower() on the string. This returns true if there are no uppercase letters AND the string contains at least one lower case letter, so a string of all special characters will not be accepted). Notes about the program: The underscore _ is used to represent a blank. At startup, the input string has the start symbol placed at the beginning and the resulting string is padded with a blank at each end. The grammar rules file contains rules of the form: left-side → right-side The program actually just splits each line on white space and uses the first string as the left side and the last string on the line as the right side, so the arrow is not really needed. If a line contains just a single letter, that letter will be interpreted as the start symbol, otherwise the start symbol is S. You do not need to close and re-start the program to change rules. You can just select a new rules file and enter a new input string. Included are some example grammars: [login to view URL] Copies an input string, alphabet = {0, 1} [login to view URL] Accepts balanced (), alphabet = {(, )} [login to view URL] Mark string center, alphabet = {0, 1} [login to view URL] Accepts palindromes, alphabet = {0, 1} [login to view URL] Accepts anb nc n, alphabet = {a, b, c} The project grammar can first work like [login to view URL], then use a similar technique to [login to view URL] to check matching characters, but will scan both strings left to right, like [login to view URL] The program is a WIP and so is not as well organized as I would like, but it will do for the purpose of checking the project.
Rif. progetto: 15894070

Info sul progetto

2 proposte
Progetto a distanza
Attivo 6 anni fa

Hai voglia di guadagnare un po'?

I vantaggi delle offerte su Freelancer

Imposta il tuo budget e le scadenze
Fatti pagare per il lavoro svolto
Delinea la tua proposta
La registrazione e le offerte sui lavori sono gratuite
2 freelance hanno fatto un'offerta media di $49 USD
Avatar dell'utente
A proposal has not yet been provided
$27 USD in 1 giorno
4,8 (2 valutazioni)
1,4
1,4

Info sul cliente

Bandiera: UNITED STATES
United States
0,0
0
Membro dal dic 17, 2017

Verifica del cliente

Grazie! Ti abbiamo inviato tramite email il link per richiedere il tuo bonus gratuito.
Non è stato possibile inviarti l'email. Riprova per piacere.
di utenti registrati di lavori pubblicati
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Caricamento anteprima
Autorizzazione per la geolocalizzazione concessa.
La tua sessione è scaduta ed è stato effettuato il log out. Accedi nuovamente per piacere.