Find Jobs
Hire Freelancers

Type 0 Grammar

$10-30 USD

Fechado
Publicado há mais de 6 anos

$10-30 USD

Pago na entrega
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.
ID do Projeto: 15894070

Sobre o projeto

2 propostas
Projeto remoto
Ativo há 6 anos

Quer ganhar algum dinheiro?

Benefícios de ofertar no Freelancer

Defina seu orçamento e seu prazo
Seja pago pelo seu trabalho
Descreva sua proposta
É grátis para se inscrever e fazer ofertas em trabalhos
2 freelancers estão ofertando em média $49 USD for esse trabalho
Avatar do Usuário
A proposal has not yet been provided
$27 USD em 1 dia
4,8 (2 avaliações)
1,4
1,4

Sobre o cliente

Bandeira do(a) UNITED STATES
United States
0,0
0
Membro desde dez. 17, 2017

Verificação do Cliente

Obrigado! Te enviamos um link por e-mail para que você possa reivindicar seu crédito gratuito.
Algo deu errado ao enviar seu e-mail. Por favor, tente novamente.
Usuários Registrados Total de Trabalhos Publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Carregando pré-visualização
Permissão concedida para Geolocalização.
Sua sessão expirou e você foi desconectado. Por favor, faça login novamente.