Find Jobs
Hire Freelancers

c++ project

$30-250 USD

Cancelled
Posted over 8 years ago

$30-250 USD

Paid on delivery
You will be given a lexer that reads tokens from standard input. Your goal is to write, in C or C++, a program that reads all tokens from standard input by calling the lexer function getToken() and stores certain tokens in a linked list. After all tokens are read, your program will print out the content of the linked list in a specific order. Lexer API There are two functions that the lexer defines. These two functions compose the application programming interface (API) of our lexer. These functions are declared in lexer.h (and implemented in lexer.c). You will find the files lexer.h and lexer.c on the submission site for project 2. getToken() reads the next token from standard input and returns its type as a token_type enum. If the token is of type ID, NUM, IF, WHILE, DO, THEN, or PRINT then the actual token value is stored in the global variable current_token as a null-terminated character array and the length of the string is stored in the global variable token_length. There are two special token_type values, END_OF_FILE, which is returned when the lexer encounters the end of standard input and ERROR, which is returned when the lexer encounters an unrecognized character in the input. ungetToken() causes the next call to getToken() to return the last token read by the previous call to getToken(). Note that this means the next call to getToken() will not read from standard input. There are four global variables declared in lexer.h that are set when getToken() is called: t_type the token type is stored here (note that this will be the same value that was returned by getToken(). current_token the token value is stored in the array current_token. If the token is of type ID, NUM, IF, WHILE, DO, THEN, or PRINT, then current_token contains the token string. For all other token types, current_token contains the empty string. token_length: the length of the string stored in current_token. line: the current line number of the input when the token was read. Requirements Your program should use the provided lexer and read all tokens from the input by repeatedly calling the getToken() function. Certain token strings and additional data should be stored in a linked list. Specifically, if either of the following conditions is true: The token is of type NUM The token is of type ID and the actual token is equal to one of the following values: "cse340", "programming", or "language" Then the token string and other information needs to be stored in a node of a linked list. The information that needs to be stored about each of these tokens in the linked list is the following: Token type (from t_type) Token value (from current_token) Line number from the input where token was read (from line) After reading all tokens from the input and storing information about tokens that match the criteria, your program should go over the linked list and print the information in reverse order from when that token was encountered. Each of the tokens in the linked list must be printed to standard output on a separate line with the following format: <line> <token_type_string> <token value> Note that <token_type_string> is the textual representation of the token type. In this case, the possible values are ID and NUM. Evaluation Your submission will be graded on the automated test cases passing, however simply passing all the test cases is not enough for full credit. Your submission will be inspected by the TAs to give you feedback on potential errors in your code. You are required to store the information in a linked list that you write (either single or double linked list). The nodes in the linked list must be allocated on the heap (using malloc or other similar functions like calloc), and the allocated memory must be freed after printing the output. You are not allowed to use the STL linked list libraries. Note that this means you are not allowed to use the C++ new operator to allocate memory (you must use the C memory allocation functions). Example Here is an example input with four lines: cse340 < < + 123 * 456 programming - cse 340 , LANGUAGE 100 . ; WHILE 200 IF Here is your program’s expected output: 4 NUM 200 3 NUM 100 3 NUM 340 2 ID programming 2 NUM 456 1 NUM 123 1 ID cse340
Project ID: 8439802

About the project

25 proposals
Remote project
Active 8 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
25 freelancers are bidding on average $151 USD for this job
User Avatar
Hello, I must be the best option to you, because I love C and C++ ... look at my profile!. Master and Phd in computer science. Just let me do it. Best regards!.
$155 USD in 3 days
5.0 (108 reviews)
7.3
7.3
User Avatar
A proposal has not yet been provided
$252 USD in 3 days
4.9 (97 reviews)
7.4
7.4
User Avatar
Hello. I have done something similar in the past, I can complete this assignment in few hours of pure working time.!
$30 USD in 1 day
4.9 (949 reviews)
7.3
7.3
User Avatar
I am very proficient in c, c++. I have 15 years c++ developing experience now, and I have worked for 5 years. My work is online game developing, and mainly focus on server side, the language is c++ under linux. I used c++ to make many great projects, for example, I made the tools which can convert java files to c++ scripts which has the same effect, of course garbage collection included. I also made our own mobile game using c++, I even can show you the demo of client. Trust me, please let expert help you.
$180 USD in 3 days
4.8 (94 reviews)
6.6
6.6
User Avatar
Looking forward to discuss further about the project details and deliver the same to your needs and specifications
$200 USD in 6 days
4.9 (37 reviews)
6.1
6.1
User Avatar
I have a bachelor in Computer Science from the American University in Cairo and a minor in Mathematics, with 10+ years of experience with hands-on programming. I have worked for the past year in Microsoft's Advanced Technology Lab in Cairo (ATLC). Kindly check my previous projects for past feedback.
$88 USD in 2 days
4.7 (21 reviews)
5.3
5.3
User Avatar
hi, i can help. i can start working right now please reply. thanks .
$177 USD in 3 days
4.9 (34 reviews)
4.5
4.5
User Avatar
A proposal has not yet been provided
$155 USD in 3 days
4.6 (23 reviews)
4.6
4.6
User Avatar
I am a Computer Software Engineer and a professional C++ developer/C. I have Excellent concepts of data structures and algorithm e.g. Linked lists, pointers, Trees, Binary Trees, stack and queues. I have read your project description and Can Do this task. Thank you for considering my proposal :)
$250 USD in 7 days
5.0 (5 reviews)
3.9
3.9
User Avatar
Hi, I have strong background in c++ and experience in Compilres. Let me help you. I am ready to start.
$200 USD in 5 days
5.0 (8 reviews)
4.0
4.0
User Avatar
100% quality work n payyyyy after tht. milestone required. LEMME know your exact budget. pm me......
$144 USD in 3 days
4.9 (7 reviews)
3.6
3.6
User Avatar
La propuesta todavía no ha sido proveída
$277 USD in 6 days
5.0 (5 reviews)
3.0
3.0
User Avatar
hello , sir : i have strong skills on c/c++ & python , worked for samsung & huawei . Now I am woking on SDN with c++ and crawler with python hope to get message from you, maybe more details is helpful thank you very much .
$200 USD in 3 days
5.0 (3 reviews)
2.7
2.7
User Avatar
This is very similar to a project I made during my graduation on computer science, first year I believe. For doing this, I would start defining a template class l_list, that would look like this: template<class a_class> class l_list { public: l_list(); ~l_list(); void push_back(a_class &value); // adds value on the end void insert(a_class &value, int pos); // adds value at pos void remove(int pos); // remove value on pos a_class* get(int pos); // retrieves value on pos a_class* pop(int pos=0); // retrieves and removes value on pos a_class* it(bool restart=false); // iterates over the list, retrieves first element then jumps to next int find(a_class value); // returns the index of value, -1 if not found private: class node { a_class value; node* next; node* previous; }; node* root; node* it; }; Then it is just needed to implement the required solution, that would be pretty fast.
$177 USD in 3 days
5.0 (2 reviews)
2.5
2.5
User Avatar
Have been working with Linux Kernel Programming since more than 2 years. Have deep insights of C/C++ programming. Have experience of developing device drivers for USB 3 devices on Xilinx Zynq Embedded Platform I can complete your project within your given deadline.
$100 USD in 3 days
5.0 (1 review)
1.6
1.6
User Avatar
dear your project is an easy task for us kindly check our profile EgLab project https://www.freelancer.com/u/JustDone.html we have built before a complete symbolic equation parser from scratch using c/c++ & VC++ we would like to take your project
$111 USD in 8 days
5.0 (1 review)
0.4
0.4
User Avatar
Предложение еще не подано
$66 USD in 2 days
0.0 (0 reviews)
0.0
0.0
User Avatar
Aucune proposition n'a encore été fournie.
$222 USD in 6 days
0.0 (0 reviews)
0.0
0.0
User Avatar
I have worked on C for almost 7 yrs. I have quoted less because of that. We can build relationship based on the quality of code.
$55 USD in 5 days
0.0 (0 reviews)
0.0
0.0
User Avatar
A proposal has not yet been provided
$88 USD in 5 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
Avondale, United States
5.0
6
Payment method verified
Member since Sep 10, 2015

Client Verification

Other jobs from this client

web page features
$30-250 USD
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.