Building A Most Simple Programming Language To Visualise Information

Hi there folks, this is my first time ever posting an entry on a online programming forum, please excuse my posting format if it is not up to the standart. While reading this topic, please consider the following: altough I am currently an undergraduate student in some area of science I really don’t like to study but I have to push through somehow, I have no formal education in software engineering, I am all the way self thaught solo learner, my terminology might be technically off, I do not state any facts, all opinions are my own, I just want to learn more, that is my only motivation here, besides going to school I basically do nothing but think of code most of the time, and I like experimenting with code. Please do not request code, I can only publish when I finish development, hopefully it will continue to work on the browser, then I will directly upload on the web editor as public access. So when I started to learn programming, I used to do more mathematical and statistical kind of modeling and simulations, they were mostly kind of abstract models, for an example as to give an idea I used to do exprimenting on topology optimization by appying affine transformations to randomly iterated function systems, which has a big name but fundamentally very very basic math actually. I told this only to explain my background as I learned programming by doing these kind of stuff. I still like these stuff but I don’t actively work on them anymore, sometimes as side quests here and there. I am well accustommed to oop, func. programming, various design patterns, this is okay, so my problem is since almost always I am the only person that sees my code, and I just programmed mathematical models for a significant period of time, I kinda developed this really weird programming style, and it kind of stuck with me, like I use multiple programming languages, my program structure is basically always same, I think except Assembly which I’m not particularly good at, yet that is. In my personal opinion it is true that oop is a management solution, I don’t understand how it is supposed to increase individual programmer efficiency. As to functional programming, I think it depends a lot in language specifics, I mean you now Javascript is a very weird language but very practical for me so I use it all the time, and I actually really like Javascript with all the strangeness, and you know it p5.js ecosystem is the cherry on the top. So both oop and functional programming are very good for certain task and I use them both to do various task like oop for creating data or func. programming for combining parsers as an example. However what my code boils down to essentially is like a lame and weird version of procedural programming. I don’t really know how to explain, for an example, I don’t like mutability so I tend to create copies of instances and operate on them. Okay so, this is actually not important, the important thing is my weird programming style is creating problems for me and I need to fix this. My problem is very specific. I’m trying to write a compiler, which is the most amount of code in a single project I ever attemted to, I am constantly messing up the scope. This might sound like a very stupid problem to specifically have but what can I say, it is what it is, I guess I am just extremely bad at adjusting the environment scope of all things. This is not a JS specific problem I’m having by the way, the scope issue happens all the time. What this tell me is that I don’t understand what happens during runtime well enough, or like the information my input code creates that leads to a scope error on the output. So I pushed the breakes on the compiler and decided to properly sort this out and then I can continue. As I said I prefer learning with an experimentation kind of aproach sometimes, figuring things out this way is very good for me. So here is my little side quest project; I am building a very simple python like programming language by writing an abstract syntax tree interpreter, it will have all the fundamental oop and fp properties, right now I’m just using vanilla JS and p5.js, that’s it, I wish to keep this project zero dependancy other than these two, let’s see how it goes. The purpose of this interpreter is the ability to visually examine how does the information changes when I change the state of the system. I can chart, graph, arrows, maps, diagrams, all these things. I think if you can parse it you can interpret it, therefore you can emulate it, so I think I can emulate different kinds of memory management, maybe try to implement garbage collection. It may be pretty slow but this will be like a experimental setup therfore we just want to visualize a shell that imitates computation so I can think of strategies to simplify and structurize my coding. I think visual representations are very good learning resources for these kind of stuff. Here is an example I like very much ( https://www.youtube.com/watch?v=OG_AZnPokGw&ab_channel=JSHeroes ) I think this is very good for understanding better. Also lately I found out about something that really caught my attention called Data Oriented Programming(Not the same thing with data oriented design they use in game development, these two are seperate things), I’m thinking on experimenting with the pradigm too on the interpreter. What do you guys think about this? If you have any insights about this or any other programming paradigm I should check out and try to impement, or any tips on how to better visualise, I try to follow somewhat of a test my way of driven development approach on this project, maybe any insigts on that or, is there anything you want to visually see how it works, I don’t know maybe a regex engine or something else. Any feedback would be much appreciated. Thank you.

Note: Right know the build is like a regular programming language, should I make it a funny language or continue as normal language. What I mean by funny language is not like strange operations or weird binding behaviours, I wrote some JavaScript jokes that I think are funny, so should I add some JavaScript humor to the language syntax, or just don’t complicate things, humor or vanilla, you decide?

Hi again, sorry I realised I forgot mention a few things in my post about the project. At first I was actually planing to implement a very basic compter algebra system functionality to the language to specifically parsing matrice operations and linear algebra mainly, because you can do a lot of things with that, I had some ideas, I mean why not try them with regular JS right, because I was not going to open a linear algebra book and implement parse every operation on the book to create like a real linear algebra solver, this would be an incredibly boring thing to do, I was planning on doing this for a specific computation task so that I had a default mathematical model I could visualize. First I thought lattice gas cellular automata, define phase space, generalized coordinates, generalized velocity, eneralized momentum, but I thought bringing derivation into this could really slow it down and most importantly I don’t want to deal with parsing derivation for Navier Stokes eq. I am still planning to implement some linear algebra math to the language for experiment with hashing. In certain spectral analysis applications the way they manage data is very very interesting. In x-ray powder diffraction they use something called fingerprinting to hold identifying information about molecular structure and compare it with a massive database to match substances. I think Shazam works somewhat similar for analysing acoustic wave spectra and matches the song on a hash database, I should look into it more. Any insight on this too would be really helpful actually. Thank you.

Hi there,

I’ll admit upfront, most of the topics and details you touch on go wayyyyyy over my head, so a lot of it reads quite abstract, even esoteric to me. But there’s enough people on this forum which will know to give you concrete feedback.

What I do know though, is sitting at the beginning of a major project and being overwhelmed by where and what the journey might lead to. The classical Blank Page Syndrome, where everything seems attractive to do and having to decide on one thing only can be paralysing.

Here’s some loose thoughts on how to get into gear and kick off your project.

  • A great solution builds on an even better problem definition. I’m not seeing that problem definition anywhere in your post. What problem are you trying to solve? Are you building something no-one has ever thought of before? Are you building something that is better than an already existing thing? What is the core improvement? What do YOU want to get out of a solution? What do you want OTHERS to get out of your solution? You should be able to frame your general problem and goal in one paragraph or less. Also, this problem definition should initially forego anything about concrete language and feature implementations.
  • If you don’t yet know what your goal IS, then it can be just as helpful to define what your goal IS NOT.
  • There’s hard constraints defined by your course, e.g. concrete marking conditions or time frames. If you intend to break or forego some of those, that’s fine. Though from experience, it’s best not to surprise your prof right at the deadline with these changes, but state your intentions early on. Good profs will always allow you the freedom to expand on the original brief if you manage to frame your goals concretely.
  • I acknowledge your free-form, explorative approach to working. I’ll also tell you that this is making your work far more difficult and fail-prone than approaching it in a frameworked manner, orienting yourself along a structured roadmap. I’ve had good results by time-boxing my free-flowing explorations. Give yourself something like a few days or up to two weeks to investigate on a topic and dive as deep as possible. Whip together some crude code. Then after the time is used up, look at what you have achieved. Is it good? Continue on that path. Is it meh? Throw it out and time-box another topic. This will allow you to keep your preferred mode of working, but also prevents you wasting too much time into something you might not use after all.
  • Park your ideas. Continuously write down all the ideas and features you’re excited about. Revisit them later when you have identified and established your core project.
  • To help filter through all your collected ideas, you might want to utilise something like a Impact/Effort Matrix. I know, I know, this feels awfully constrained. In truth, it’s a neat low-friction tool allowing yourself to think about all your ideas and get a superficial sense of what would make sense to implement and work on next.
  • Keep the project scope in mind. You clearly have a breadth of knowledge and huge motivation to explore a lot of it in this project. The danger lies in adding too many ideas too early into your project and getting lost in the push and pull between them all. Start small. Essentially start building a thing that you might even consider “child’s play”. If that’s up and running, start adding to that. And add to that again, rinse and repeat. Before you know it, that basic thing has grown into a mature, amazing and unique solution.
  • Kill your darlings. This is one of the hardest ones. Be very honest about features and functionalities you might love to implement, but just aren’t a good fit or a massive time sink for this project. Scratch them from the project.
  • Share early, share often. Don’t aim at a polished result that will amaze everybody when you decide to publish it. Instead, as soon as you have a basic, fundamental thing that generates some kind of output, show it to people (and your prof!). Let them tell you if they find it relevant to their work and if they see any utility in it. And yes, it’s the hardest things to pour passion into a topic you deem relevant, just to hear everybody around you wave it off. Acknowledge all honest feedback and tweak your project trajectory.
  • Addendum to the previous point: You can absolutely decide to build a thing which satisfies only your very own narrow criteria. But again, tell your prof and get their sign-off on this route.

All the best on your endeavours!

1 Like

Dear eightohnine, thank you for your feedback, these are very good advice for me, I really appreciate that. Sorry for all the verbosity on my post, mind feels like a tornado sometimes, I definitely need to work on that just like you said. As I tried to explain in my first post my problem statement is that I’m trying to write a compiler, to be specific, my own adaptation of Immo Landwerth’s Minsk compiler, he has a great series on building his Minsk compiler on YouTube ( https://youtube.com/playlist?list=PLRAdsfhKI4OWNOSfS7EUu5GRAVmze1t2y&si=Yq-8ev0zt92MCiQD ), I’m writing my adapted version of this all from scracth line by line, however I guess I overstepped a bit so I am now writing this ast interpreter to visually try to understrand how to not constantly mess up and cause scope errors in my code. Also I need to lay down a structure for my code because it is very unorganized and messy right now. I want to test different programming approaches in this project to see how I can improve my style efficiently. What I am doing is not part of any uni course I take, in school the department I’m studying at is not related to these stuff thus I have no proffessors to get help in my specific programming objectives. So nobody at school expects me to write any code, and I don’t have an exact time limit because these are purely personal projects. Like I mentioned I have no formal software engineering education, I am a self learner in this. As a matter of fact I am extremely unhappy with my current academic situation but my only option is to persevere so programming is not an academic thing for me, I do it because I like it and because of programming I am keeping my ember to go forward. Thank you for all your great advice eightohnine, I too wish you the best in all your endeavours. My most sincere respects…