Find Jobs
Hire Freelancers

Type 0 Grammar

$10-30 USD

クローズ
投稿日: 6年以上前

$10-30 USD

完了時にお支払い
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: 15894070

プロジェクトについて

2個の提案
リモートプロジェクト
アクティブ 6年前

お金を稼ぎたいですか?

Freelancerで入札する利点

予算と期間を設定してください
仕事で報酬を得る
提案をご説明ください
登録して仕事に入札するのは無料です
この仕事に2人のフリーランサーが、平均$49 USDで入札しています
ユーザーアバター
A proposal has not yet been provided
$27 USD 1日以内
4.8 (2 レビュー)
1.4
1.4

クライアントについて

UNITED STATESのフラグ
United States
0.0
0
メンバー登録日:12月 17, 2017

クライアント確認

ありがとうございます!無料クレジットを受け取るリンクをメールしました。
メールを送信中に問題が発生しました。もう一度お試しください。
登録ユーザー 投稿された仕事の合計
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
プレビューを読み込み中
位置情報へのアクセスが許可されました。
あなたのログインセッションの有効期限がきれ、ログアウトされました。もう一度ログインしてください。