bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

commit 7058b4ef1df9d3a40edcba14f24d3773514d5a72
parent 76e08913f6be09384bf62663f32fadb5f7a3333e
Author: Amit Dutta <amitdutta4255@gmail.com>
Date:   Fri,  6 Feb 2026 19:14:24 +0530

[2026-02-06] : .\Semester_1\khurapati-idea : added new prototype-MOJIC

Diffstat:
ASemester_1/khurapati-idea/KI004.c | 30++++++++++++++++++++++++++++++
ASemester_1/khurapati-idea/interpeter.py | 86+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdocs/index.html | 144+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 260 insertions(+), 0 deletions(-)

diff --git a/Semester_1/khurapati-idea/KI004.c b/Semester_1/khurapati-idea/KI004.c @@ -0,0 +1,29 @@ +/* + * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 27 Jan 2026 + * Repo: https://github.com/notamitgamer/bsc + * License: MIT | Copyright (c) 2026 Amit Dutta + */ + +/* Trying to write code only with emoji */ + +#include<stdio.h> + +#define πŸ˜’ int +#define 😊 main +#define πŸ˜‚ ( +#define 🀣 ) +#define ❀️ printf +#define 😍 ; +#define πŸ™Œ return +#define πŸ‘ scanf +#define 😁 " +#define πŸ‘Œ { +#define 😘 } + +πŸ˜’ πŸ˜ŠπŸ˜‚πŸ€£πŸ‘Œ + πŸ˜’ num😍 + β€οΈπŸ˜‚πŸ˜Enter the number: 😁🀣😍 + πŸ‘πŸ˜‚πŸ˜%d😁, &num🀣😍 + β€οΈπŸ˜‚πŸ˜Entered number: %d😁, num🀣😍 + πŸ™Œ 0😍 +😘+ \ No newline at end of file diff --git a/Semester_1/khurapati-idea/interpeter.py b/Semester_1/khurapati-idea/interpeter.py @@ -0,0 +1,85 @@ +# Author : Amit Dutta <amitdutta4255@gmail.com> +# Date : 06 Feb 2026 +# Repo : https://github.com/notamitgamer/bsc +# License : MIT License (See the LICENSE file for details) +# Copyright (c) 2026 Amit Dutta + +import sys +import os +import subprocess +import re + +# Set the absolute path to your GCC compiler based on your system logs +COMPILER_PATH = r"G:\bsc\MinGW64\bin\gcc.exe" + +def run_universal_compiler(): + if len(sys.argv) < 2: + print("Usage: python emojic.py <file.c>") + sys.exit(1) + + source_path = sys.argv[1] + if not os.path.exists(source_path): + print(f"File not found: {source_path}") + sys.exit(1) + + with open(source_path, 'r', encoding='utf-8') as f: + content = f.read() + + mapping = {} + # Extract emoji mappings from #define statements + define_pattern = re.compile(r'#define\s+(\S+)\s+(.+)') + + lines = content.splitlines() + code_lines = [] + + for line in lines: + match = define_pattern.match(line.strip()) + if match: + emoji_key = match.group(1) + c_value = match.group(2).strip() + mapping[emoji_key] = c_value + else: + code_lines.append(line) + + translated_code = "\n".join(code_lines) + + # Sort keys by length descending to replace multi-emoji tokens correctly + sorted_keys = sorted(mapping.keys(), key=len, reverse=True) + + for key in sorted_keys: + translated_code = translated_code.replace(key, mapping[key]) + + # Ensure standard header is present if logic needs it + header = "#include <stdio.h>\n" + if "#include" not in translated_code: + translated_code = header + translated_code + + temp_file = "output_target.c" + with open(temp_file, "w", encoding="utf-8") as f: + f.write(translated_code) + + exe_name = source_path.rsplit('.', 1)[0] + ".exe" + compile_cmd = [COMPILER_PATH, temp_file, "-o", exe_name] + + try: + # Use shell=True for better command resolution on Windows + result = subprocess.run(compile_cmd, capture_output=True, text=True, shell=(os.name == 'nt')) + + if result.returncode == 0: + print(f"Compilation Successful: {exe_name}") + run_cmd = [f".\\{exe_name}"] if os.name == 'nt' else [f"./{exe_name}"] + subprocess.run(run_cmd, shell=(os.name == 'nt')) + else: + print("Compilation Error:") + print(result.stderr) + + except FileNotFoundError: + print(f"Error: Compiler '{COMPILER_PATH}' not found.") + print("Please ensure GCC is installed and added to your PATH,") + print("or edit COMPILER_PATH in this script to point to your gcc.exe.") + + if os.path.exists(temp_file): + os.remove(temp_file) + +if __name__ == "__main__": + run_universal_compiler()+ \ No newline at end of file diff --git a/docs/index.html b/docs/index.html @@ -5926,6 +5926,150 @@ int dsort(int *arr, int n) }</div> </div> + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-khurapati-idea-KI004-c', 'KI004.c', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/khurapati-idea/KI004.c')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">KI004.c</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/khurapati-idea/KI004.c" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-khurapati-idea-KI004-c" style="display:none;">/* + * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 27 Jan 2026 + * Repo: https://github.com/notamitgamer/bsc + * License: MIT | Copyright (c) 2026 Amit Dutta + */ + +/* Trying to write code only with emoji */ + +#include&lt;stdio.h&gt; + +#define πŸ˜’ int +#define 😊 main +#define πŸ˜‚ ( +#define 🀣 ) +#define ❀️ printf +#define 😍 ; +#define πŸ™Œ return +#define πŸ‘ scanf +#define 😁 &quot; +#define πŸ‘Œ { +#define 😘 } + +πŸ˜’ πŸ˜ŠπŸ˜‚πŸ€£πŸ‘Œ + πŸ˜’ num😍 + β€οΈπŸ˜‚πŸ˜Enter the number: 😁🀣😍 + πŸ‘πŸ˜‚πŸ˜%d😁, &amp;num🀣😍 + β€οΈπŸ˜‚πŸ˜Entered number: %d😁, num🀣😍 + πŸ™Œ 0😍 +😘</div> + </div> + + <div class="file-item flex items-center justify-between px-3 py-2 hover:bg-white hover:shadow-sm rounded-lg transition-all group border border-transparent hover:border-slate-100 mb-1"> + <div class="flex items-center gap-2.5 min-w-0 cursor-pointer flex-1" onclick="showCode('code-Semester_1-khurapati-idea-interpeter-py', 'interpeter.py', 'https://github.com/notamitgamer/bsc/blob/main/Semester_1/khurapati-idea/interpeter.py')"> + <svg class="w-4 h-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor"> + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> + </svg> + <span class="text-sm text-slate-600 font-medium group-hover:text-blue-600 truncate">interpeter.py</span> + </div> + <div class="flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity"> + <a href="https://github.com/notamitgamer/bsc/blob/main/Semester_1/khurapati-idea/interpeter.py" target="_blank" class="p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-100 rounded-md" title="View on GitHub"> + <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-2.126 1.029-2.935-.103-.253-.446-1.372.097-2.897 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.525.202 2.644.1 2.897.64.809 1.026 1.841 1.026 2.935 0 3.847-2.337 4.687-4.565 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg> + </a> + </div> + <!-- Embedded Code Storage --> + <div id="code-Semester_1-khurapati-idea-interpeter-py" style="display:none;"># Author : Amit Dutta &lt;amitdutta4255@gmail.com&gt; +# Date : 06 Feb 2026 +# Repo : https://github.com/notamitgamer/bsc +# License : MIT License (See the LICENSE file for details) +# Copyright (c) 2026 Amit Dutta + +import sys +import os +import subprocess +import re + +# Set the absolute path to your GCC compiler based on your system logs +COMPILER_PATH = r&quot;G:\bsc\MinGW64\bin\gcc.exe&quot; + +def run_universal_compiler(): + if len(sys.argv) &lt; 2: + print(&quot;Usage: python emojic.py &lt;file.c&gt;&quot;) + sys.exit(1) + + source_path = sys.argv[1] + if not os.path.exists(source_path): + print(f&quot;File not found: {source_path}&quot;) + sys.exit(1) + + with open(source_path, &#x27;r&#x27;, encoding=&#x27;utf-8&#x27;) as f: + content = f.read() + + mapping = {} + # Extract emoji mappings from #define statements + define_pattern = re.compile(r&#x27;#define\s+(\S+)\s+(.+)&#x27;) + + lines = content.splitlines() + code_lines = [] + + for line in lines: + match = define_pattern.match(line.strip()) + if match: + emoji_key = match.group(1) + c_value = match.group(2).strip() + mapping[emoji_key] = c_value + else: + code_lines.append(line) + + translated_code = &quot;\n&quot;.join(code_lines) + + # Sort keys by length descending to replace multi-emoji tokens correctly + sorted_keys = sorted(mapping.keys(), key=len, reverse=True) + + for key in sorted_keys: + translated_code = translated_code.replace(key, mapping[key]) + + # Ensure standard header is present if logic needs it + header = &quot;#include &lt;stdio.h&gt;\n&quot; + if &quot;#include&quot; not in translated_code: + translated_code = header + translated_code + + temp_file = &quot;output_target.c&quot; + with open(temp_file, &quot;w&quot;, encoding=&quot;utf-8&quot;) as f: + f.write(translated_code) + + exe_name = source_path.rsplit(&#x27;.&#x27;, 1)[0] + &quot;.exe&quot; + compile_cmd = [COMPILER_PATH, temp_file, &quot;-o&quot;, exe_name] + + try: + # Use shell=True for better command resolution on Windows + result = subprocess.run(compile_cmd, capture_output=True, text=True, shell=(os.name == &#x27;nt&#x27;)) + + if result.returncode == 0: + print(f&quot;Compilation Successful: {exe_name}&quot;) + run_cmd = [f&quot;.\\{exe_name}&quot;] if os.name == &#x27;nt&#x27; else [f&quot;./{exe_name}&quot;] + subprocess.run(run_cmd, shell=(os.name == &#x27;nt&#x27;)) + else: + print(&quot;Compilation Error:&quot;) + print(result.stderr) + + except FileNotFoundError: + print(f&quot;Error: Compiler &#x27;{COMPILER_PATH}&#x27; not found.&quot;) + print(&quot;Please ensure GCC is installed and added to your PATH,&quot;) + print(&quot;or edit COMPILER_PATH in this script to point to your gcc.exe.&quot;) + + if os.path.exists(temp_file): + os.remove(temp_file) + +if __name__ == &quot;__main__&quot;: + run_universal_compiler()</div> + </div> + </div> </div>
Β© notamitgamer β€’ Site Built: 2026-07-21 13:58:23 UTC β€’ git-mirror commit: 1037f62 [view raw info]
Originally created with stagit β€’ modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror