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 > "True!";

} str String > "False!";

#print result

print("a^2+b^2 = c^2 is" , String);


So far my code looks as shown above. It is taking 3 numbers and the declarations are "data type" "ID" > "data", like java where its int a = 5;. Except rnum is the type "real number" followed by a the ID of the data and > to signify its declaration and 4 as the data. Through out the code you see similar patterns, besides the print, which takes the string followed by the string variable that contains a string that it is separated by a comma. That sums up my first week.


Comments