boginka's corner

Writing the Interpretter

February 18, 2025

I fixed the expressions today which was a lot easier than I thought it would be. Maybe later or tomorrow I'll work on the arrow syntax in the main method and then hopefully it just works? I have a pretty good example written up already that has a lot of the functionality in it so we'll see how it goes! Also, I'm not sure what I want to work on next. Probably something wiith PyTorch to be able to put AI on my resume.

February 17, 2025

Today, I finally got a basic program to run! Here it is:

            process void hi3(){
               func(){
                    int a = hi4();
                    if(a == 2){
                         int c = 3;
                         print(c);
                    } else{
                         int d = 2; 
                         print(d);
                    }
                    
               }
          
               helper void hi4(){
                    int d = 2;
                    emit d;
               }
            }
            
            
            main(){
                 hi3();
            }
        

It prints out the variable based on the result of a method. Next time, I will work on fixing the expressions to work fully in an if statement.

February 16, 2025

I've been disorganized with my git commits and these entries to keep track of what I did. BUT I pushed up some changes today that included the conditional statements working. However, I accidentally discovered that I set up the scope incorrectly and a process shares a scope with all of its methods, which I don't like. So, I'll have to work on fixing the scope tomorrow so that a process has shared process declarations but seperate variable declarations based on method. Another thing I have to look at, is expressions. I got through some of the expression part today so that a == 2 returns true or false correctly but I have to do more complex statements like a + 2 != 0 and a == b/1 or a >= a. I think something like that will capture all parts of an expression to check if it works. I also have to make sure that an expression can return an int if needed and not just a boolean like I was testing for inside conditionals today. I think after that, I'll be pretty close to done (maybe)? I feel like everytime I think I'm close I discover that lthis project has another layer that I didn't realize before. At least it was a good experience to learn something I didn't know how works before. I know there's still a lot hidden under the tip of the iceberg, like compiled languages, but I'm happy with the knowledge I gained.

February 6, 2025

I added scope into the visitor and my language can print out hi from a variable! I want to finish the visitor in the next couple of days so I can get process calls working correctly and then I also want to add a benchmark for it so that the program automatically prints the time it took for each program. I'm going to need to add a way to store the top level processes so that when main calls it, it can look at that scope. But I'll keep this page updated. Mainly, so I can remember what I did if it takes me another month to keep going like it's been.

January 26, 2025

I started the visitor a few days ago and have been picking at it. Since this isn't an object oriented language, the visitor is not implemented with an generic visit() method in each class, instead it goes through each of the ast nodes in my tree and interprets them. Thankfully, the temporary print method I have been keeping up on is what is required for this so I had a good start. I was able to get the expressions down but they need to be tested. I also think I may have structured my ast incorrectly because I was the main method to be at the root node so that I can evaluate the program in order. I currently have [process1, ... , processn, main]. So, I think I need to restructure this and then add scope to my visitor so when you call a process inside of the main method it can run it.