Thursday, May 12, 2011

Draft 1 released and grammar for Modelica+MetaModelica

The implementation of the grammar for Modelica+MetaModelica is almost done. Only a large subset will be implemented. However it is large enough to parse my own OMCC as showed in the last post.

The corrections from the draft 1 and some additions regarding the development of the grammar and some fixed and additions were introduced in draft 2.

Thesis status: Implementation 99.9% (as usual with software projects never end).
Report draft2 sent.

Hopefully the presentation defense will be schedule soon.

Tuesday, May 10, 2011

My parser can parse itself

Finally after several months of hard work, I have archive the OMCC parser generator for MetaModelica and Modelica grammar. It is still a subset but it is working pretty fine.

The grammar for modelica file is about 700 lines of code. The files generated even more. In the last test it took around 6 seconds to parse all the file. This is quite big but it was running in debug mode. It means that some other optimizations should be made before the end of the thesis.

A new version of the draft will be released soon. So I hope I can post here the day of the presentation very soon when I talk with my examiner.

this was the last result of the test


***************-ACCEPTED-***************

SUCCEED - (AST)
args:ParserModelica.mo
Total time:6.113409437

Friday, May 6, 2011

draft 1 delivered

I just finished the first draft of the thesis, now it is under my supervisors review. However, the testing set for a subset of the Modelica grammmar wont be enough for the examiner, so I am currently working on extending the grammar for the parser while waiting for comments over the draft 1.

Thursday, April 21, 2011

Extra help to finish OMCC and Opponents selected

Extra help has arrived to help me finishing my report. Yes, the AMAZON kindle is finally with me, and here is the first glimpse of my thesis on a kindle.


I am currently into the various sections of the report trying to finish everything by next week when the first draft will be public.

That is why I have selected my opponents and also the thesis I will be the opponent as a part of the graduation requirement. Everything looks fine to start May with the revision of the draft and plan the presentation for the middle of May.

Sunday, April 17, 2011

Roadmap to the end of the thesis

Finally, I am reaching the light at the end of the tunnel.

Soon I will be done with this project, this is the output of the last meeting with my supervisor for the road map until the end of the project.


Now my activities are 100% on finishing the first draft of the thesis, after that I will start to create the grammar for a subset of modelica and use the OMCC to build the compiler :D

It is very probable that some adjustments may be necessary, but I will have pleanty time until the presentation to fix them.

The initial goal of finishing the thesis by the end of april is looking more and more a reality.

Soon ... the first draft :D
Posted by Picasa

Tuesday, April 12, 2011

OMCC with error handling

I have been working on the thesis very hard lately, so far I have
accomplished this:

* Lexer and Parser
* Lexer and Parser Generator
* Error Handling

The last part is now working like this:

It uses error recovery to detect more errors, but it always fails at the end. Right now it only recovers from the action ERASE token, however if there are tokens with errors nearby it will stop parsing.

From the papers I read, I have this primary error handling techniques (single correction) which could be insert, replace or erase. So far I have not implemented MERGE because my parser only understand tokens and has no idea about the semantic value of the tokens. I need to implement a table to look for the semantic value, also important for displaying the errors with the right String not with the Token NAME as now.

***ERRORS WERE FOUND AND COULD NOT RECOVER ***

Syntax Error near [TOKEN:T_DO 'do' from (line:3 col:18) until (line:3
col:20)], ERASE token
Syntax Error near [TOKEN:T_ADD '+' from (line:4 col:13) until (line:4
col:14)], INSERT token {T_INTCONST or T_IDENT}
Syntax Error near [TOKEN:T_ADD '+' from (line:4 col:13) until (line:4
col:14)], REPLACE token with {T_LPAREN}
Syntax Error near [TOKEN:T_ADD '+' from (line:4 col:13) until (line:4
col:14)], ERASE token
Syntax Error near [TOKEN:T_IDENT 'y' from (line:8 col:5) until (line:8
col:6)], INSERT token {T_THEN}

program file:

1/* this is while test of comment */
2read x y z w;
3while x <> 99 do do
4 ans := (x++1) - (y/3);
5 write ans;
6 read x, y;
7 if x = 10
8 y := 234;
9 endif
10end


My thesis is getting close to the end, I hope it can be completed by the end of this month.

Wednesday, April 6, 2011

OMCC - (OpenModelica Compiler-Compiler)

Compiler-Compiler is a term that refers to a program that can generate a parser for compiler, so the new name after a deliberation with my Examiner is OMCC, having in mind that OMC is the command line instruction for the current compiler, I think that OMCC will be easily remembered for the new developers that start to work in this compiler and base their work on my thesis.

$omcc MetaModelica
..... Generating files
DONE!