Posts

Showing posts from February, 2022

Week 4

Image
  This is parser code right now. I've finished the BNR and now have to take that and put in my parser code so it can look at the grammar of my code. I'm about 25% with my parser code. Next week I probably have it finished and should be able to show the results and what it looks like finished because a lot of the statements haven't been defined yet, so I can't run my code and debug and see if it does what its suppose to. As you can see right now I have what my statements, the statements, and defined some of those statements. I also defined the operators that could be used or are in the sample code. Once I run it it will tell me if it matches what It found then print the prinf statement. Once I finish this I will see if I can go further than this, but if not then the parser will be the ending of this project.

Week 3

Image
  Just to show what my code looks like. The code is suppose to run and check if the numbers can make a real right triangle. I'm trying to make the start of comments different so I made them"&" putting "!" instead of ";". I wanted to make a bit less similar to java. Keeping it simple so I can get further through the process and maybe make it more complex once I learn more. I'm now figuring out the BNF and structure of my code, which I have started. Its basically a copy and paste from the one we did in class except I'm trying to figure out what I want to be different.  For now I think the grammar looks fine, but after I finish the grammar I will try to make a parser. This is how my scanner is formatted for right now. I might be hard to read, but I have been able to figure how to snip it or take partial screenshots so I can make it bigger.

Week 2

  Week 2 I was tasked to actually make the scanner, so I took the scanner that we did in class, copy and pasted to another file and started to look at the text and Identify the super fiscal things of the code. The keywords, the letters used, the punctuation, numbers, etc. I'm making the scanner print out numbers for what it sees so for">" it might print "4" so I know it recognized it as what I want it to. Learning from my first scanner and make sure that it takes spaces, tabs, comments, and doesn't bug out. It also takes anything unknown and prints it so I know it doesn't recognize it, until its all numbers and it makes the pattern that I want. The next step will be to make the grammar and create a parser for the language. I've made some progress on the scanner and trying to debug because I'm having trouble running the scanner. rnum { printf("1: %s\n", yytext) ;} str { printf("3: %s\n", yytext); } [-+]?[0-9]*\.[0-9]+ {print...

Week 1

  The first week I decided to research algorithms, but before I do the research I'm doing a side project and building a scanner, and BNF for a small language I create. The project idea was bought up by my 240 professor because we were using regular expression to finish a scanner and scan his already own made language, emcee. This idea followed by the TRAIN meeting sparked my interest to try and complete this project. So, after some thinking I built a small program that checks Pythagorean theorem numbers. So far I've learned how to do regular expressions and vaguely what a scanner should look like and how to implement it into my terminal on my raspberry pi. I still need to how a general vision of my language so I can define possible future variables just in case I wanna expand and try to make the language more complex.  #pythagorean theorem checker rnum a > 4; rnum b > 3; rnum c > 5; #pythag=a^2 + b^2 =c^2 #checks the numbers if(c^2>(a^2+b^2)) { str String > ...