🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🪟 Windows TippsSetting up live captions stuck in Windows 11(14.09.2026 um 16:31 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
🪟 Windows TippsWindows 11's latest update broke my speakers, and I'm not alone(14.09.2026 um 18:54 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🪟 Windows TippsSetting up live captions stuck in Windows 11(14.09.2026 um 16:31 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
🪟 Windows TippsWindows 11's latest update broke my speakers, and I'm not alone(14.09.2026 um 18:54 Uhr)

🔧 Programmierung 🕛 vor 3 Monaten 5 Min Lesezeit
0

I tried to create a programming language... in python

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

I know you're wondering, why Python? Out of all other programming languages that exist? Just why?



Well, I chose it because it was simple, easy to use, and kinda intuitive, seeing that it felt like natural language to me. I also just learned it in a course I was pursuing in university and decided to give it a shot. It couldn't be that bad, right?






Actually, it wasn't bad, just a bit unfamiliar



You see, I've been creating my own programming languages behind the scenes. However, they were made in C++, which seemed like a more appropriate choice. Given that it's fast and offers better management of memory, performance, etc., you might ask, "So why didn't you just stick with it?"



I hated myself I wanted to expand my knowledge in Python and see what all the hype was about! So join me in this little endeavor of exploring the magic of Python programming!






Introducing pyp lang!




Pyp lang is a very complex and scary programming language designed to create anything you imagine with just one function!




Yeah, I wish it were that too, but in all seriousness, pyp is just a really fancy calculator that reads input from files and spits out the computed result.



We gotta start somewhere, and that somewhere is setting up our directory with simple Python files and a sample .pyp file for testing.




CODE
/pyp
index.pyp - our source code file
/src
index.py - our main file to run pyp







Our sample file - index.pyp



This file just contains a simple expression!



CODE
1 + 1







Our main file - index.py



index.py contains the code necessary for getting the source code from pyp/index.pyp. It turns out Python is really simple and abstracts away majority of the headache!



But first, we need a way to get the file path. So I tried out the pathlib and sys libraries to fetch it from the command line.



CODE
import sys
from pathlib import Path

# this is just a display help function when the file path isn't provided!
def display_help():
print("welcome to pyp!")

# the guts of the whole thing!
def run_pyp_file(args):
pyp_path = args[0] # we would fetch the pyp input file path here
pyp_file_path = Path(pyp_path) # and convert it to a path!

# if the file doesn't exist, we tell the user!
if not pyp_file_path.exists():
print(f"could not find the path {pyp_path} :(")
return

# and finally, we open the file for reading the source code
with open(pyp_file_path) as pyp_file:
source = pyp_file.read()
print(source)

def main():
# fetching the arguments from the command line
args = sys.argv[1:] # decided to get rid of the index.py path

# the arguments wouldn't have the pyp input file if the len is 0!
if len(args) < 1:
display_help() # show a helpful message
return

run_pyp_file(args) # run the guts!

if __name__ == "__main__":
main()





Finally, running the result with this command:



CODE
python src/index.py pyp/index.py





Gave me this as the output!



CODE
1 + 1





We did it!!



...





What's that sys.argv thing?



Honestly, I'm still learning about the sys library, but it just represents the command line arguments as a list!



CODE
# sample.py
# when printing sys.argv, it gives you a list based on what you provide via the command line
print(sys.argv)





If we run the above with the command python sample.py in the command line, it would print the following:



CODE
['sample.py']





If you'd like to try it yourself, you can copy the snippet and run it with more arguments! Try this one in the command line:



CODE
python sample.py hello world





You should see:



CODE
['sample.py', 'hello', 'world']





More information about sys.argv below.















argv



What on Earth is it!?



Edit: If you can, will you please write a line or two and explain how it works?












Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen

Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
The Gemini desktop app is now available for Windows
1 Quelle
Setting up live captions stuck in Windows 11
1 Quelle
Burn Out, Or Fade Away
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten I tried to create a programming language... in python

Thematisch verwandte Begriffe: tried, create, programming, language · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...