Re: Writing a Parser
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Re: Writing a Parser




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: Writing a Parser  
Cesar A. K. Grossmann


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-03-04 02:24 AM

Well, the parser worked pretty well. Now I can concentrate in the
program itself. If somebody has any advice to give, I'm open to suggestions.

I have a file (call it a "database") with two kind of records, one kind
telling the price of the most basic components, and the other describing
a structure made of parts, that can have parts themselves. The idea is
to produce a report telling the cost of all parts that are not basic,
i.e., that are composites.

After coming to a structure to describe the structure, I must be able to
report some errors or flaws:

1. parts that are not described and are not basic components;

2. parts that are described by themselves in any means (circular
definitions, as A is made by A, or A is made by B that is made my A);

3. parts that are described twice (or more times).

I'm still somewhat confused by the problem and the complexity of it. My
first approach is to use a linked list to maintain the basic ("atomic")
itens, and another that maintain the composite itens. All elements of
the composite list will have another small list: the list of its parts.
I can reach that, but I'm not sure how to resolve the 3 flaws above,
that can happen in the "database".

Perhaps I should put in the start of the list the itens that was no
referred by others (i.e., walk in the list, and when you find an item
that uses the item that you currently are trying to insert, then you
must insert it before that one), add a field "total cost of this item"
and resolve it top-down, but how to detect a loop? If I order the list
this way, every item that I reach must be perfectly definible in means
of the itens that precede it in the list. If it is not defined, then I
have a definition missing.

Does someone has a better (and more simple) idea?

TIA
--
.O.  Cesar A. K. Grossmann ICQ UIN: 35659423
..O  http://www.LinuxByGrossmann.cjb.net/
OOO  Quidquid Latine dictum sit, altum viditur





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:47 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register