Project contains three tasks below;
1. task - SCANNER
Scanner represents the interface between the original program and parser. Its task is to give parser terminal symbols. Its task is also to exclude the empty spaces, new line breaks, and comments.
Scanner reads the input file as a string of characters which are then composed of the terminal symbols. For a description of the symbols used we use finite state automaton, which can be implemented by a two-dimensional table.
Expand the program of arithmetic expressions in such a way that will also support the following operations:
sin | cos | abs | sqr
2 + 5 * 2 + cos (0)
'2' integer (1 , 1)
'+' operator (1 , 3)
'5' integer (1 , 5)
'*' operator (1 , 7)
'2' integer (1 , 9)
'+' operator (1 ,11)
'(' separator(1 ,17)
'0' integer (1 ,18)
')' separator(1 ,19)
2. task - PARSER
Parser task is to identify the syntactical correctness given sequence of terminal symbols prf scanner. Write LL(1) parser for the programming language of arithmetic expressions with the following grammar:
E: T = EE;
EE: = EE + T | - T EE | epsilon;
T: F = TT;
TT: = TT * F | / F TT | epsilon;
F: = (E) | cos (E) | sin (E) | abs (E) | sqrt (E) | # float | - # float;
2 + 5 * 2
true (program OK)
3. task - EVALUATOR
Write evaluator for arithmetic expressions. Evaluator task is to evaluate the given arithmetic expression. Parser from previous task has to be upgraded with semantic functions in order to obtain a numerical evaluation of the value of the input stream.
2 + 5 * 2
Đã trao cho:
6 freelancer đang chào giá trung bình $50 cho công việc này
Hello, Sir I have 3 years experience on C++ programming. I understand your requirements. I have solution of your requirements. So you can trust on me for better solution.