Find Jobs
Hire Freelancers

ANSI-C variable/type parser based on Roskind grammar

$30-50 USD

In Progress
Posted about 20 years ago

$30-50 USD

Paid on delivery
For this project, I need an extension to the Roskind grammar ( [login to view URL] ) so all data-related elements of an ANSI-C file are output in an easy to use data structure. ## Deliverables After the input file is parsed, one single pointer is returned, to a data structure describing all the type definitions encountered while parsing, and the variable definitions encountered. The returned data structure should use the definition of "struct Data" (see the attached file "returnType.h"). The data structure above can be modified slightly in order to accommodate all the cases in ANSI-C, but you need to keep in the spirit of this structure being easy to traverse. In order to make the job easy, you can ignore variable initialization (but don't make a parse error). You don't need either to optimize the usage of the structure (i.e. you can have duplicate Type elements if it's easier). As an example, If you parse the following: enum Foo {BAR, BAZ}; struct Blah { Foo foo; void *quux; int *xyzzy; } blahblah; You should obtain the resulting data structure (assume 'p' is the pointer returned after the parsing, p is of type Data*): // This describes the variable "struct Blah blahblah;" p[0].dataType == VARIABLE, p[0].data.variable->name == "blahblah", p[0].data.variable->type == &p[1] // This describes the type "struct Blah {...};" p[1].dataType == TYPE, p[1].data.type->name == "Blah", p[1].data.type->basicType == STRUCT, p[1].data.type->numberOfAggregates == 3, p[1].data.type->aggregates == {&p[3], &p[4], &p[5]} // This describes the variable "enum Foo {...};" p[2].dataType == TYPE, p[2].data.type->name == "Foo", p[2].data.type->basicType == ENUM // This describes the three fields of "struct Blah" p[3].dataType == VARIABLE, p[3].data.variable->name == "foo", p[3].data.variable->type == &p[2] p[4].dataType == VARIABLE, p[4].data.variable->name == "quux", p[4].data.variable->type == &p[6] p[5].dataType == VARIABLE, p[5].data.variable->name == "xyzzy", p[5].data.variable->type == &p[7] // This describes types for the three fields of "struct Blah" p[6].dataType == TYPE, p[6].data.type->name == NULL, p[6].data.type->basicType == POINTER, p[6].data.type->pointed = &p[8] p[7].dataType == TYPE, p[7].data.type->name == NULL, p[7].data.type->basicType == POINTER, p[7].data.type->pointed = &p[9] p[8].dataType == TYPE, p[8].data.type->name == NULL, p[8].data.type->basicType == VOID p[9].dataType == TYPE, p[9].data.type->name == NULL, p[9].data.type->basicType == INT (the index order may vary depending on how you build your structures) ---------- 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables): a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment. b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request. 3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement). ## Platform Linux, with gcc, bison/flex
Project ID: 3126687

About the project

1 proposal
Remote project
Active 20 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
See private message.
$42.50 USD in 20 days
5.0 (1 review)
1.3
1.3

About the client

Flag of CANADA
Pointe-Claire, Montreal, Canada
5.0
10
Payment method verified
Member since Feb 10, 2004

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.