13
submitted 6 months ago* (last edited 6 months ago) by hardkorebob@programming.dev to c/programming@programming.dev

Examples of an interesting computer programming paradigm.

18
9
submitted 6 months ago* (last edited 6 months ago) by hardkorebob@programming.dev to c/programming@programming.dev

Please enjoy my mind contraptions for learning purposes.

pnk.lang is a DSL made in Shell Script that compiles to Python. Abstracting indentation and category of functions into colors[capital letters] using the tag_add method from tkinter. For me it reduces cognitive load and also you write much less Python boilerplate.

shimky is the IDE for pnk.lang built in pnk.lang. It has some vim behaviors/modes/commands and an internal bash shell/command line, an mp3 player[mpv] and a youtube music downloader command line. Paste a URL and hit Ctr-n and you get a refreshed mp3 list with new mp3 renamed for POSIXish.

Here I made a small pnk.lang IDE for Red using shimky. ;)


Get shimky/pnk.lang : https://github.com/dislux-hapfyl/shimky

Get Red: https://github.com/red/red

#allerrorsmatter #hacktheplanet #redlang #ahdahwm

[-] hardkorebob@programming.dev 4 points 6 months ago

Fork it and Make Pull Request. đź‘Ť

6
submitted 6 months ago* (last edited 6 months ago) by hardkorebob@programming.dev to c/programming@programming.dev

A Shell DSL that transforms into Python.

I created this IDE to spin up Tkinter UIs or anything Python with less boilerplate and rich cognitive and efficiency shortcuts: for me, I think this tool helps me prototype GUI apps quicker with less characters typed so less effort.

I would love to take this further if I could get anyone interested. Thanks.

https://github.com/dislux-hapfyl/shimky

PD: Both Titles are Correct

20
submitted 6 months ago by hardkorebob@programming.dev to c/linux@lemmy.ml

A Shell DSL that transforms into Python.

I created this IDE to spin up Tkinter UIs or anything Python with less boilerplate and rich cognitive and efficiency shortcuts: for me, I think this tool helps me prototype GUI apps quicker with less characters typed so less effort.

I would love to take this further if I could get anyone interested. Thanks.

https://github.com/dislux-hapfyl/shimky

[-] hardkorebob@programming.dev 3 points 6 months ago

Yeah! What he said!

[-] hardkorebob@programming.dev 2 points 6 months ago

I wanna make some cool stuff. I just need some other hackers like me. LOL

12

This code is a highly abstracted and unconventional script that appears to be for generating Python code using Bash shell script constructs within a shell scripting context, translating them into Python code generation. Here's a breakdown of what different parts of the script do:

Function Definitions:

The script defines several functions (ZDimp, ZDas, ZDshebang, etc.) that output Python code. Each function generates specific parts of Python code, like imports, class definitions, and method definitions. Functions like ZFtoorwin, XIcv, and ZDcld are used for generating more complex constructs like class instantiation and method invocation within classes. Control Structures:

It includes shell-based control structures to create conditional (if, elif, else) and looping constructs (for, while) in the generated Python code. The constructs use a mix of direct shell commands and placeholders for Python code, indicating that the script likely works alongside other tools or scripts that provide inputs dynamically. Instance and Function Call Generation:

Functions for setting instance variables (ZIfv, YIfv, etc.) and making function calls (ZFfc, YFfc, etc.) dynamically build Python code that manipulates class instances and calls methods. These functions are versatile, allowing for different indentation levels and conditions to be specified dynamically. Utility Operations:

Functions like XFshsp, XFpyev, and others handle subprocess execution, text manipulation, and variable assignment within the generated Python environment. These functions are intended to be flexible and reusable across different parts of the generated code, indicating a modular approach to code generation. Error Handling and Debugging:

The script includes structures for try-except-finally blocks (XKtry, XKexcp, XKfin), allowing generated Python code to handle exceptions effectively. This suggests that the generated code is expected to run in environments where robust error handling is necessary. In summary, this Bash script serves as a meta-programming tool that dynamically generates Python code. It abstracts Python programming constructs into shell script functions, allowing the script writer to generate complex Python applications using shell command syntax. This approach is unconventional and seems tailored for specific use cases where such a level of abstraction is beneficial, perhaps in automated code generation tools or educational environments where showing the transformation of simple commands into Python code can be illustrative.

19
submitted 6 months ago by hardkorebob@programming.dev to c/linux@lemmy.ml

https://github.com/dislux-hapfyl/shimky

This code is a highly abstracted and unconventional script that appears to be for generating Python code using Bash shell script constructs. It mimics object-oriented programming concepts within a shell scripting context, translating them into Python code generation. Here's a breakdown of what different parts of the script do:

Shebang and Author Information: The script starts with a shebang for Bash, and author details are provided in a comment.

Global Variables:

Various variables are set for use within the generated Python code, such as bg for background color, datenow for the current date and time, px and py for padding values, etc. S, E, and _ are shorthand for self, echo, and expr respectively, simplifying the syntax for commonly used operations. Function Definitions:

The script defines several functions (ZDimp, ZDas, ZDshebang, etc.) that output Python code. Each function generates specific parts of Python code, like imports, class definitions, and method definitions. Functions like ZFtoorwin, XIcv, and ZDcld are used for generating more complex constructs like class instantiation and method invocation within classes. Control Structures:

It includes shell-based control structures to create conditional (if, elif, else) and looping constructs (for, while) in the generated Python code. The constructs use a mix of direct shell commands and placeholders for Python code, indicating that the script likely works alongside other tools or scripts that provide inputs dynamically. Instance and Function Call Generation:

Functions for setting instance variables (ZIfv, YIfv, etc.) and making function calls (ZFfc, YFfc, etc.) dynamically build Python code that manipulates class instances and calls methods. These functions are versatile, allowing for different indentation levels and conditions to be specified dynamically. Utility Operations:

Functions like XFshsp, XFpyev, and others handle subprocess execution, text manipulation, and variable assignment within the generated Python environment. These functions are intended to be flexible and reusable across different parts of the generated code, indicating a modular approach to code generation. Error Handling and Debugging:

The script includes structures for try-except-finally blocks (XKtry, XKexcp, XKfin), allowing generated Python code to handle exceptions effectively. This suggests that the generated code is expected to run in environments where robust error handling is necessary. In summary, this Bash script serves as a meta-programming tool that dynamically generates Python code. It abstracts Python programming constructs into shell script functions, allowing the script writer to generate complex Python applications using shell command syntax. This approach is unconventional and seems tailored for specific use cases where such a level of abstraction is beneficial, perhaps in automated code generation tools or educational environments where showing the transformation of simple commands into Python code can be illustrative.

[-] hardkorebob@programming.dev 3 points 7 months ago

shimky a vim clone weird thing in pnk.lang

https://github.com/dislux-hapfyl/shimky

[-] hardkorebob@programming.dev 3 points 7 months ago

I learned so much from this! Its funny I have been working on shell stuff.

https://github.com/dislux-hapfyl/pynksh

[-] hardkorebob@programming.dev 4 points 7 months ago

I need to build a site like this for my app lol

Very nice is what I am saying!

[-] hardkorebob@programming.dev 3 points 7 months ago* (last edited 7 months ago)

https://youtu.be/q2tfkVe6hTo

https://github.com/dislux-hapfyl/pynksh

Working on making dev of tkinter and pythong* a breeze for any newcomer that's willing to learn a bit different from the mainstream tutorials, videos, docs and mass methods of learning. This guy's ways are more fun than any of those YT videos of piecemeal-coding. If you find that kind of learning extremely boring hmu fam...

*I dont like python syntax, it's uGly, but I do because it was waiting for me to abstract it away by creating pnk.lang. When you see my repo you will understand, maybe...

#allerrorsmatter

[-] hardkorebob@programming.dev 12 points 7 months ago

Key in anything. Faulty language is faulty everything from there on out.

12

Using Tkinter and Some Ninja CLI Skillz

10

cross-posted from: https://programming.dev/post/12104901

https://github.com/dislux-hapfyl/pynksh

Writing functional shell snake code to improve my sanity.

5
Functional Shell Snake (programming.dev)
submitted 7 months ago* (last edited 7 months ago) by hardkorebob@programming.dev to c/programming_languages@programming.dev

In Oct’23 a basic Text widget with Subprocess to run shell commands allowed me to take my command line fu into a different arena because Tkinter gave me special tricks. This tool (shell functions) allows me to type up GUI apps or any Python script with less effort, for my fingers and brain.

wc newide; ksh newide | wc

513 1641 10859 newide [shell functions]

600 1959 29558 newide [python file]

The blocks of color are capital letters colored using tkinter methods (tag_add & tag_configure) with a bg and fg of the same color to make it look like a lego block, it’s all ASCII. On the right, an idle clicker game/toy made with pnk.lang, also just ASCII/UTF-8. The IDE you see in the pic also was coded using functional shell language I call pnk.lang and the original first iteration of this specification is in the legacy folder in the repo below. Just me learning how to code faster in Python but in shell but in neither at this point.

https://github.com/dislux-hapfyl/pynksh

https://www.reddit.com/r/pnk/

Don’t be put off by Ksh because Bash can also interpret it, since it’s just shell functions that print Python code. But I have plans to use an Xbox controller so I can move away from building with the keyboard at piecemeal rates. I will do this by abstracting away identifiers and all data we use as engineers into “dictionaries” to then transform it into a spatial system. I already done this first step! Using a basic grid with a maximum of 10 rows x 3 cols, indexing row[0-9] col[0-2], as you see there on the left side, and by using a letter I then categorize the functions of pnk(shell+python) so I can have 30 x 26[a-z] available slots; a00 b11 k22 and so on…by making it a visual shortcut that reduces cognitive load and typing for me.

Take a closer look at my repo without dismissing it too quickly. It could seem unnecessary but maybe someone else can see what I have made as useful and how we gonna take it to higher levels of abstraction and create a new realm for making computer applications in an abstract game/IDE of art and code. Perhaps it’s that creator effect that happens when you make something for the first time that makes me see its future utility and appeal. All this was made incrementally using my own software I built from scratch. I do have a great vision and would love to speak to anyone who is interested. I also demonstrate the utility of this small tool on youtube[link in repo]. Thanks.

[-] hardkorebob@programming.dev 10 points 7 months ago* (last edited 7 months ago)

In Oct’23 a basic Text widget with Subprocess to run shell commands allowed me to take my command line fu into a different arena because Tkinter gave me special tricks. This tool (shell functions) allows me to type up GUI apps or any Python script with less effort, for my fingers and brain.

wc newide; ksh newide | wc

513 1671 11018 newide in pnk

604 1987 29867 newide in python

The blocks of color are capital letters colored using tkinter methods (tag_add & tag_configure) with a bg and fg of the same color to make it look like a lego block, it’s all ASCII. On the right, an idle clicker game/toy made with pnk.lang, also just ASCII/UTF-8. The IDE you see in the pic also was coded using functional shell language I call pnk.lang and the original first iteration of this specification is in the legacy folder in the repo below. Just me learning how to code faster in Python but in shell but in neither at this point.

https://github.com/dislux-hapfyl/pynksh

https://www.reddit.com/r/pnk/

Don’t be put off by Ksh because Bash can also interpret it, since it’s just shell functions that print Python code. But I have plans to use an Xbox controller so I can move away from building with the keyboard at piecemeal rates. I will do this by abstracting away identifiers and all data we use as engineers into “dictionaries” to then transform it into a spatial system. I already done this first step! Using a basic grid with a maximum of 10 rows x 3 cols, indexing row[0-9] col[0-2], as you see there on the left side, and by using a letter I then categorize the functions of pnk(shell+python) so I can have 30 x 26[a-z] available slots; a00 b11 k22 and so on…by making it a visual shortcut that reduces cognitive load and typing for me.

Take a closer look at my repo without dismissing it too quickly. It could seem unnecessary but maybe someone else can see what I have made as useful and how we gonna take it to higher levels of abstraction and create a new realm for making computer applications in an abstract game/IDE of art and code. Perhaps it’s that creator effect that happens when you make something for the first time that makes me see its future utility and appeal. All this was made incrementally using my own software I built from scratch. I do have a great vision and would love to speak to anyone who is interested. I also demonstrate the utility of this small tool on youtube[link in repo]. Thanks.

[-] hardkorebob@programming.dev 16 points 7 months ago

What about this?

16

korn shell wrapper that outputs python code: you write shell > out comes the snake

view more: next ›

hardkorebob

joined 8 months ago