Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Implement a parser for the programming language myC– in Project one using FLEX and BISON. The parser builds an abstract syntax tree (AST) for the input program and then pretty-prints the AST. Write.
Five programs in myC–. Your programs must collectively use all types of statements. For instance, you may have a myC– program that reads three numbers and printing the maximum of these numbers and another myC– program that prints the sum of integers from 1 to n where n is obtained by an input statement

What I have tried:

I couldn’t even start it I tried to solve it all day. This is a assignment I need to submit it today. This is my first time in this website. Hope I can get a help. Thank you
Posted
Updated 5-Oct-21 8:33am
Comments
RickZeeland 5-Oct-21 13:57pm    
myC ? never heard of it and can't even find it when Googling, are you sure you spelled that correctly?
Azor Ahai 5-Oct-21 14:03pm    
I’m sorry, by myC it means c programming here
Greg Utas 5-Oct-21 13:58pm    
This is far from an assignment for a novice, and you left it until the day it's due? You've got a serious problem, not the least of which is that this isn't a site where people do homework for you.
Azor Ahai 5-Oct-21 14:04pm    
I didn’t leave it like that. I’ve been tryin to solve this all day. For couple days

 
Share this answer
 
Comments
Azor Ahai 5-Oct-21 14:23pm    
Thank you
Nobody can write this for you, nor should they.

First, you would learn nothing at all, and that's not helping you.

Second, there is no specification for the "myC" language. Without that, you cannot possibly implement a parser, let alone do it in FLEX and BISON.
 
Share this answer
 
Comments
Azor Ahai 5-Oct-21 14:23pm    
Thank you
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]

But to be honest, you have probably left it too late if you have to submit today - you have procrastinated too long I suspect. Take that as a lesson: deadline are important, and time management really does matter.
 
Share this answer
 
Comments
Member 15028314 5-Oct-21 23:44pm    
These solutions presented here, don't even come close in answering the initial
question asked, none of them. It reminds me of my compiler construction class,
where I went to college. To implement a parser, you need to start at square one.
First, write a lexical analyzer, then a symbol table, and then a parser, and then
I believe there are a few more major phases left to build and implement. The
first two steps aren't to bad to write, but the parser phase is a real challange to
write. So the owner of this initial question better get his little caboose running
down the track. You have state/next-state table(s) to construct. Correct syntax
grammer better fit/follow the state/next-state tables. Also, include syntax/grammer
error detection. With making these tables, you are going to be drawing lines all
over the place. That's all my little brain remembers, but it takes times and
patience, and not asking anybody else to do your school work. Parsers are not
built overnight.
OriginalGriff 6-Oct-21 1:47am    
So how would you respond to the OP when he asks for "Implement a parser for the programming language ... This is a assignment I need to submit it today"?

Even if we wanted to do his homework for him (and I suspect this assignment was given some months ago) there is no way we could practically do it for him. So unless he has the bulk of the work done - and his question doesn't indicate that at all - there is nothing we can do except tell him to pull his finger out earier next time ...
Azor Ahai 25-Oct-21 7:19am    
This alone motivates me to work on my programs more. thank you.i appreciate it.
Member 15028314 6-Oct-21 23:31pm    
Okay, OriginalGriff: A teacher would say, have you done anything?? Show me. This is like asking a college professor for an "A", when you have not done anything to warrant a grade of "A". So, if you want it bad enough, better start producing the lexical analyizer, and symbol table setup, and the startings of a new language parser, We/I would think about some help.
OriginalGriff 7-Oct-21 2:09am    
What kind of help do you give on a big project that doesn't appear to have been started? :sigh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900