diff --git a/README-ar.md b/README-ar.md new file mode 100644 index 0000000..97244df --- /dev/null +++ b/README-ar.md @@ -0,0 +1,198 @@ +

+ +brainfuc*k interpreter + +

+ +# ممترجم بسيط وREPL للغة brainfu*k مكتوب باللغة Rust🦀 +#### *اقرأ هذا في لغات أخرى.* +[EN English](README.md) +## المميزات +-مترجم بسيط وREPL للغة brainfu*k مكتوب باللغة Rust 💫 +- تشغيل brainfuc * k رمز مباشر من REPL🚀 +- دعم أحرف UTF-8 بما في ذلك الرموز التعبيرية 😍 (اختياري) +- يمكنك التحكم في حجم المصفوفة 📏 + +## تثبيت + +- من crates.io: + ```shell + cargo install bfy + ``` +- من aur: + ```shell + yay -S bfy + ``` + +## الخيارات والحجج +
+ جدول الخيارات + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
اختياروصفإفتراضي
-h, --helpطباعة معلومات المساعدة
-V, --versionيطبع معلومات الإصدار
-f, --features + الميزات الإضافية للتمكين
+ القيم الممكنة: +
    +
  • no-reverse-value:
    + إذا كانت القيمة تريد إنقاص القيمة وكانت القيمة 0 ، فلا تعين القيمة على 255 ، وإلا قلل القيمة.
    + إذا كانت القيمة تريد زيادة القيمة وكانت القيمة 255 ، فلا تقم بتعيين القيمة على 0 ، وإلا قم بزيادة القيمة. الاسم المستعار هو: + "nrv" +
  • +
  • reverse-pointer:
    + إذا كان المؤشر في نهاية المصفوفة ، فاضبط المؤشر على 0 ، وإلا قم بزيادة المؤشر.
    + إذا كان المؤشر في بداية المصفوفة ، فاضبط المؤشر على نهاية المصفوفة ، وإلا قلل المؤشر. الاسم المستعار هو: `rp` +
  • +
  • allow-utf8:
    + اسمح باستخدام أحرف utf8 (32 بت) ، وإلا فلن يُسمح إلا باستخدام أحرف 8 بت.
    + استخدم هذه الميزة بحذر لأنها تزيد حجم الخلية من 8 بت إلى 32 بت.
    + كما يسمح لك باستخدام الرموز التعبيرية في كود مخادعك: D ، هذا إذا استطعت + حافظ على عقلك حتى تتمكن من الوصول إلى قيمتها الرقمية :).
    + يمكن لـ "u32" في الصدأ تخزين القيم من 0 إلى 4294967295 فقط ، لكننا + يمكن فقط استخدام 0 إلى 1114111 (0x10FFFF) في الوقت الحالي. الاسم المستعار هو: `utf8` +
  • +
+
غير متوفر
-a, --array-sizeحجم المصفوفة30000
-w, --without-tilesلا تقم بطباعة المربعات (مثل رمز الخروج واسم الملف وما إلى ذلك)
+
+ + +
+مساعدة خيار الإخراج + +```shell +bfy --help +``` +```text +Brainfu*k interpreter and REPL written in Rust + +Usage: bfy [OPTIONS] [SOURCE] + +Arguments: + [SOURCE] + The brainfuck source code file to run (if not will be entered in REPL mode) + +Options: + -f, --features + Possible values: + - no-reverse-value: + If the value is you want decrement the value and the value is 0, don't set the value to 255, otherwise decrement the value. If the + value is you want increment the value and the value is 255, don't set the value to 0, otherwise increment the value. The alias are: + `nrv` + - reverse-pointer: + If the pointer at the end of the array, set the pointer to 0, otherwise increment the pointer. If the pointer at the beginning of the + array, set the pointer to the end of the array, otherwise decrement the pointer. The alias are: `rp` + - allow-utf8: + Allow the use of utf8 characters (32 bit), otherwise only 8 bit characters are allowed. Use this feature with caution because it + increases the cell size from 8 bits to 32 bits. It also allow you to use the emoji in your brainfuck code :D, This is if you can + preserve your mind so that you can access their digital value :). The `u32` in rust can only store values from 0 to 4294967295, but we + can only use 0 to 1114111 (0x10FFFF) for now. The alias are: `utf8` + + -a, --array-size + The brainfuck array size + + [default: 30000] + + -w, --without-tiles + Dont print the tiles (e.g. exit code, file name, etc) + + -h, --help + Print help information (use `-h` for a summary) + + -V, --version + Print version information +``` + +
+ +### أمثلة + +```bash +bfy test_code/hello_world.bf +``` +```text +Hello world! +Successfully ran brainfuck source code from file: test_code/hello_world.bf +Exiting with code: 0 +``` + +```bash +bfy -w test_code/hello_world.bf +``` +```text +Hello world! +``` + +```bash +bfy test_code/print_hi_yooo.bf +``` +```text +Hi yoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo!Successfully ran brainfuck source code from file: test_code/print_hi_yooo.bf +Exiting with code: 0 +``` + +```bash +bfy -w test_code/print_hi_yooo.bf +``` +```text +Hi yoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo! +``` + +```bash +bfy test_code/like_cat.bf +``` +![output](./screenshots/like_cat_output.png) +> ملاحظة: الإخراج ليس هو نفسه الإصدار الحالي للمترجم الفوري ، ولكنه مماثل لإخراج المترجم الفوري عندما أكتب الكود. + +## REPL +```bash +bfy # REPL mode +``` +![print @ and A in the repl](./screenshots/repl_print_at_and_A_0.1.0.png) + +## لكى يفعل +- [ ] أضف المزيد من الاختبارات +- [ ] أضف المزيد من الأمثلة +- [ ] قم بإنشاء منسق brainfu * k +- [ ] أضف تمييز بناء الجملة في REPL +- [ ] أضف الإكمال التلقائي في REPL +- [ ] دعم ميزة حجم الصفيف الديناميكي + +## مصادر +- [Brainfuck in Wikipedia](https://en.wikipedia.org/wiki/Brainfuck) +- [Programming in Brainfuck](http://cydathria.com/bf/brainfuck.html) +- [Brainfuck: An Eight-Instruction Turing-Complete Programming Language](http://www.muppetlabs.com/~breadbox/bf) +- [brainfuck-visualizer](https://github.com/usaikiran/brainfuck-visualizer) +- [Basics of BrainFuck](https://gist.github.com/roachhd/dce54bec8ba55fb17d3a) +- [An elegant programming language: Brainfuck](https://www.neperos.com/article/raqehg6b24ceadba) diff --git a/README.md b/README.md index 4305653..ac3aa4f 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@

# brainfuc*k interpreter: a simple brainfuc*k interpreter and REPL writen in rust 🦀 +#### *Read this in other languages.* + +[AR Arabic-العربية](README-ar.md) ## Features - Run brainfuc*k code from a file 💫 @@ -194,4 +197,4 @@ bfy # REPL mode - [Brainfuck: An Eight-Instruction Turing-Complete Programming Language](http://www.muppetlabs.com/~breadbox/bf) - [brainfuck-visualizer](https://github.com/usaikiran/brainfuck-visualizer) - [Basics of BrainFuck](https://gist.github.com/roachhd/dce54bec8ba55fb17d3a) -- [An elegant programming language: Brainfuck](https://www.neperos.com/article/raqehg6b24ceadba) \ No newline at end of file +- [An elegant programming language: Brainfuck](https://www.neperos.com/article/raqehg6b24ceadba)