This is my first contribution to the community in terms of software.
Another parser :-) ... but... it is run time interpreted, written in c++.
Download it freely from:
http://www.horion.it/download.html
Any advice ar wellcomed.
Lollo.
This is my first contribution to the community in terms of software.
Another parser :-) ... but... it is run time interpreted, written in c++.
Download it freely from:
http://www.horion.it/download.html
Any advice ar wellcomed.
Lollo.
1. Your indenting is... a little "odd". Rather the lack of indenting is odd :-).
2. Where is the build system? :-(
Why it's odd? :-)
Every indenting has its positive and negative, I think. :-)
It's a project for eclipse ganymede..however in the debug dir there is the makefile.
but you can compile it from command line in the usual way.
Last edited by lollobrigido; 01-15-2009 at 07:22 AM.
A quick look at
int example_cls::ExeFuncDispatch():
Are these things not supposed to be enums or something else that makes them more easily understandable?Code:... case -1: ... case -2: ... case 20: ... case 1: ... case 2: ...
Are there perhaps better ways to store and search for variables, e.g. a sorted list, binary tree or something like that, so that the search of 1000 variables doesn't average at 500 string compares?Code:bool example_cls::FindVar(string varname,vector<PExe_var_t>::iterator &var) { for(vector<PExe_var_t>::iterator it=PExe_data.vars.begin();it<PExe_data.vars.end();it++) if(it->name==varname) { var=it; return(true); } return(false); // se non lo trova }
Also, comments in English would make it much more internationally appealing.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
The ExefunctionDispatch is a function written by who use the Hlang class, and the function numbers cannot be enums because these number are specified in the grammar and not in the code itself
Yes, but Example_cls is only an example on how you can use the Hlang class. The interest must relies in the class not in how the example is done! It serves oly to show how you can use the class
Sorry for the comment...I checked for it..but perhaps I missed something.
It's a work in progress...next uploat I correct it.
However I'm very happy for yours interest in my work :-))
Lollo
Last edited by lollobrigido; 01-15-2009 at 07:39 AM.
Your zip file contains .o and .d files - I think you do not want to distribute those.
Some files (for example exmple.cpp and HLang.cpp) appear to contain inconsistent line-endings (meaning a mix of CR/LF and LF only) - Eclipse probably don't care, but other editors do sometimes.
HLang.cpp:
I take it all those 0, 5, 10, 10, 1000, 55 and other number constnats in this code also can't be enums or constants?Code:case 0: // symb p.prod.clear(); // load defaults p.semantic.function_ndx=-1; p.semantic.params.clear(); p.semantic.setlevel=0; p.semantic.after=false; p.symbol=gramtok.firstToken(); st=5; break; //............................ case 5: tmp=gramtok.firstToken(); if(tmp==":=") st=10; else { cerr << "ERROR (grammar): expected ':=' @ " << line << endl; st=1000; // error } break; //............................ case 10: // produzione tmp=gramtok.firstToken();
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
file .o or .d ....it's results of my compilations..In the next upload I skip it.
and...yes it's right...in that case your suggestion is valid, in the next release I substitute it by enums....and I saw another italian comment ....ooops!
For bad chars \r\n ...it's strange because I've developed it all by the same editor in and always in Linux: ..however i check it.
good!
Last edited by lollobrigido; 01-15-2009 at 08:07 AM.
I've updated the archives for who is interested in...
Lollo