new Parser/scanner library

This is a discussion on new Parser/scanner library within the Linux Programming forums, part of the Platform Specific Boards category; This is my first contribution to the community in terms of software. Another parser :-) ... but... it is run ...

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    35

    new Parser/scanner library

    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.

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    1. Your indenting is... a little "odd". Rather the lack of indenting is odd :-).
    2. Where is the build system? :-(

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    35
    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.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    A quick look at
    int example_cls::ExeFuncDispatch():
    Code:
    ...
    case -1:
    ...
    case -2:
    ... 
    case 20:
    ...
    case 1:
    ...
    case 2:
    ...
    Are these things not supposed to be enums or something else that makes them more easily understandable?

    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
    }
    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?

    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.

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    35
    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.

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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:
    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();
    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?


    --
    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.

  7. #7
    Registered User
    Join Date
    Jan 2008
    Posts
    35
    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.

  8. #8
    Registered User
    Join Date
    Jan 2008
    Posts
    35

    Archives update

    I've updated the archives for who is interested in...
    Lollo

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What's an import library?
    By chiefmonkey in forum C++ Programming
    Replies: 1
    Last Post: 06-19-2009, 06:00 PM
  2. Property Set Library (PSL) - Announcement
    By vultur_gryphus in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 05-29-2008, 07:04 AM
  3. Makefile for a library
    By sirmoreno in forum Linux Programming
    Replies: 5
    Last Post: 06-04-2006, 05:52 AM
  4. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 08:55 AM
  5. better c string functions
    By samps005 in forum C Programming
    Replies: 8
    Last Post: 11-04-2003, 01:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21