200 likes | 278 Views
Mr. Proper. Nabil Shahid William Blinn Jeff Lin Matthew Anderegg. Who is Mr. Proper…. … and why did we name our language after him? Step 1. Do hours of work on O.S. assignment. Step 2. Google for hints on how to compile. Step 3. Make mrproper Step 4. Cry. What is MrProper?.
E N D
Mr. Proper Nabil Shahid William Blinn Jeff Lin Matthew Anderegg
Who is Mr. Proper… … and why did we name our language after him? Step 1. Do hours of work on O.S. assignment. Step 2. Google for hints on how to compile. Step 3. Make mrproper Step 4. Cry.
What is MrProper? • Easy to use • Powerful • Multi chat client support • Log file manipulation A multi format log file manipulation language.
Mrp: Easy to Use • Hides complexity. • Logs become primary data type. • Log manipulation akin to integer manipulation.
Mrp: Powerful • Broad functionality. • Analysis of conversations. • Lexical and syntactic analysis. • Text transcription of log files.
Mrp: Multi Chat Client Support • Scalable to support other log formats from various chat clients. • Current built in support for: • AIM • Trillian • Plain text
Mrp: Log File Manipulation • Eliminates file read/write overhead from user programs. • Built in operations such as loading, parsing, saving, and converting log formats.
Why Mr.Proper? • Find links that friends send you. • Search logs for expressions, words, phrases. • Easily convert old conversation logs when switching chat clients. • Parse and format conversation logs to make online publishing easier.
Control Structures • Expressions • log l = open(“logroot”, “screenName”, 0); • int x = a + b + 1; • Loops • int i;for (i = 1:10) { print (“hello”); } • Functions • func log addLogs (log oldLog) { // code }
String Functions • print() – Prints a string to standard out. • void print (string boo); • strLength() – Returns the length of a string as an integer. • int strLength (string foo) • concat() – Joins two strings and returns the result. • string concat (string moo, string noo); • substr() – Returns part of the input string as a new string. • string substr (string poo, int offset, int length); • contains() – Searches one string for another (using regexps) and returns a boolean. • bool contains (string line, string regexp)
Log File Manipulation Functions • createLog() – Creates an empty log. • open() – Loads a log file into the program. • save() – Writes log file back to disk. • convert() – Covert log from one format to another. • logLength() – Returns the number of messages in the log.
Log Message Functions • getMessageName() – Returns the name of the person who wrote the message. • getText() – Returns the text of the message. • getTime() – Returns time of message as number of seconds elapsed since 01/01/1970. • createMessage() – Creates a new empty message. • setName() – Modifies the name in the message. • setText() – Modifies the text of the message. • setTime() – Modifies the time of the message.
Sample Code func int foo(int x) { return x + 3; } main { int x = 0; for(i = 1:3) { x += foo(x); } print(x); } This program will output the value 15
Log File Manipulation: Function func int wordCount(string word, string path) { log myLog = open(path, “mybuddy”, 1); int i; int length = logLength(myLog) -1 ; int count = 0; string text; for (i = 0:length) { text = getText(getMessage(myLog, i)); if (contains(text, word)) { count += 1; } } return count; }
Log File Manipulation: Main main { int count = wordCount(“hello”, “/mylogs/trillian”); print(count); } Program trace?
Execution of an Mrp Program • MrProper is an interpreted language. • The interpreter takes in a file containing Mrp code, and the instructions are executed as they are encountered.
Testing Plan • Test each component as a module. • .mrp test scripts to go over every part of the language. • Manual and automated semantic error checking. • Test all data types. • Control flow. • Input/output files. • Test component interaction.
Lessons Learned • Understand the basic tools before you try to use them and before assuming that something is wrong with the code. • Create a more detailed project plan. Don’t rely on given milestones. • Learn to balance working together and dividing up tasks.
The Bright Future of Mr. Proper • Added support for other chat clients. • User defined log formats for reading and writing. • Graphical interface for browsing and searching through log files (tree?)