Don't wanna be here? Send us removal request.
Text
The End
So after all that, despite the bugs, I decided to make an IDE. (Non programmers, an IDE is the Integrated Development Environment. It's the place where you can write code, fix it, and run it.)
I can't claim that Pan Deity (very original, eh?) if a fully functional IDE. In fact, it's just a text editor that, when prompted, runs a different script to run the code and display the output in the command line.
Let's get into the nitty-gritties, shall we?
I started out by making a very basic Tkinter GUI that had a text box and scroll bars.
Once that was done, I added a couple of menus for controlling the file and editing it. Basically the File menu and the Edit menu.
I did some shenanigans and mapped some keyboard controls to the GUI and made all the Accelerators (aka the Ctrl + R's and all those) work.
I created a save, save as and open function:
(that's from the 'Open' function)
Basically, every time it saved, it was fairly standard, but for opening, I literally just cleared the entire text and rewrote the contents from the file. I also added a Boolean check to see whether the file was saved before opening, to make sure that content is not lost.
The new file function just cleared the screen.
But even after doing all that, the problem remained in running it.
After going through a lot of options, I finally decided to do a bit of cheating. Basically, I made a folder in the directory that the compiler was in. This folder was where temporary files could be saved. Irrespective of where the file you're working on was stored, when you ran it, the content would get copied, pasted into a temporary .pcf (Paneity Code File) file, and then that file would be run, instead of yours. Once the output was displayed, the file was cleared and that was it.
Of course, to make that possible, every time you open the compiler, you have to either click Ctrl + M, or click on the 'Map Compiler' button in the File Menu. What that does is make sure that the compiler knows where on the local machine it's located, so that the running can actually happen.
Unmapped running does this:
When you map:
And then when you run:
And of course, finally, to make sure that you can actually see your output and save it or whatever, I put in a check in the compiler that actually runs the file, such that the output closes iff you press 'q'.
0 notes
Text
The Middle
I began by looking at Lexers and generating syntax trees.
Here's a snippet from my lexer:
Through a series of if else statements, tokens in the form of Keywords, Number Nodes, comments, et cetera, were found and stored.
Once the tokens were generated, they needed to be Parsed. What I ended up doing was less of a parse into Python, and more of a step by step execution of the program.
Here's a snippet from my Parse Result class:
wAfter parsing, the code was just sorted into different types of tokens, and the symbol table for the 'current' Paneity code was updated. After that, the result would be printed out.
Eg. -
FOR i = 0 TO 5 THEN
PRINT(i)
END
For anyone who has coding experience, you know this is a fairly simple program. The time complexity is nearly constant.
For non-programmers, this is so close to English that you can pretty much guess what this does.
Either way, the expected output is this:
0
1
2
3
4
This is the output from the program:
That 0 at the end is because that's the exit code.
Either way, this is working. Only problem? BUGS GALORE. I'll be uploading this on Github soon and share it around to fix this damn thing. Probably.
0 notes
Text
The Beginning
I fell down a rabbit hole of esoteric languages when I found out about LOLCODE. I'm not proud to say this, but I devoted 4 days and learnt it.
As I read up more and more, I was fascinated by the existence of so many bizarre, but technically Turing Complete languages. Noting that, I began working on Paneity. This was my foray into Esolangs, but before I could actually start working on an Esoteric Language, I needed to do a trial. Modelled after Basic, I made a parser, lexer, interpreter and basically all the components needed to make Paneity.
Finally, after 2200 lines of Python code (including comments and blank lines), I have a working language with functions, arrays, variables and types.
0 notes
Text
Series 1 - Paneity
The following posts will concern Paneity, a personal project that is a new programming language. It has been written in Python, and there already exists a basic IDE, all made by me.
0 notes