Lexer and parser for advanced calculator (Flex + bison)

It is necessary to develop the application in C or C ++ programming language, using tools

for developing lexers and parsers, which works as an advanced calculator. Calculator

calculates mathematical expressions line by line, while having the ability to store in

variables and calls of trigonometric functions. Calculator description:

• The print command is used to print the value of an expression.

• The types of data that can appear in expressions are strings and real


• operations that can be performed with real numbers are addition, subtraction

less, multiplication and division (+, -, *, /) respecting the priority of multiplication and

divisions over the other two,

• It is possible to group expressions using pairs of parentheses (), [] and {} which are

they do not differ in functionality, but contribute to clarity

expression :

a = 56*([5 + 4.7 * (6-2/3) - 8.875] + 5.87)

print a


• there is an unary operator -, which denies the value of the expression.

print 10 + 20


print -10 + 20


print ---10


• The operation that can be performed with strings is the build, which it uses

operator &,

• If a string and expression are found in the operation, the expression must be evaluated and converted

him into his textual representation,

print "Temperature is" & 20 & "degrees

The temperature is 20.000000 degrees

print "Temperature is" & (20 * 9/5 + 32) & "Fahrenheit"

The temperature is 68.000000 Fahrenheit

• It is possible to use the functions of one argument sin, cos, sindeg and cosdeg which

calculate the sine and cosine of the angle in radians, ie degrees. Functions

can be used with or without parentheses around the argument, eg sin (0.456) and sin

0.456 are equivalent. When calling with parentheses, you may not specify an expression

inside parentheses. If we omit the brackets, only the number can be passed

or a variable as a parameter, not an entire expression.

print sin(90)


print sindeg 90


print sindeg(3*30)


To remember the results of arithmetic expressions, as well as to use these values

in other expressions, variables of arbitrary name may be used (rule

naming as in C language). The variables are exclusively of the real number type. It's not

it is possible to store a string in a variable.

• Variables are assigned a value by the operator =.

• An assignment operation is also an arithmetic expression whose value is exactly

assigned value so that it is possible to write an expression that variables b

assigns a value of 3 and then assigns the same value to variable A:

foo_ = bar1 = 3

print foo_


print bar1


• The print command can also be used to print multiple values ​​(expressions),

where values ​​(expressions) are separated by commas (eg print var, 4, 5/10).

Each comma-separated value is printed in a new line on the standard


print foo_ + 5, "bar = " & bar1, 10.0


bar = 3.000000


The calculator takes all commands from the standard input. Anything that is not precisely specified

fictional or cannot be inferred from the example below, you can realize it arbitrarily,

but not to violate any of the above.

The implemented task should contain a Makefile that compiles

the program uses the make command and generates an executable file named calculator.

Навыки: Linux, UNIX, Программирование на С

О работодателе:
( 3 отзыв(-а, -ов) ) Tuzla, Bosnia and Herzegovina

ID проекта: #32704345

5 фрилансеров(-а) готовы выполнить эту работу в среднем за $106


I CAN COMPLETE YOUR PROJECT EASILY Hello, I am programmer with enough experiences on C/C++ for 13 years. C/C++ is nice programming language and I am majoring on it for long years so I have confident to complete your pr Больше

$200 USD за 7 дней(-я)
(5 отзывов(-а))

Hello, I'm an expert C,C++ developer with experience in object-oriented, data structure and more advanced. I can help you to finish this project with great quality. We can negotiate on price/Budget Regards Relevant Ski Больше

$140 USD за 1 день
(9 отзывов(-а))

Hi, I am a very talented software programmer with 13+ years of development experience (5+ years professional work experience). I am a results-oriented professional and possess experience using cutting-edge development Больше

$30 USD за 3 дней(-я)
(4 отзывов(-а))

Hi, I can build your interpreter using Bison parser generator and Flex lexer generator, in C language. I've built interpreters before, therefore I'm experienced in compiler development and I can help you build your cal Больше

$110 USD за 9 дней(-я)
(0 отзывов(-а))

Hi, I am an experienced C++ programmer (5 years). I have specialized in math, so this calculator will be no problem for me. I would love to work for You on this project and will deliver great results. I will do the jo Больше

$50 USD за 3 дней(-я)
(0 отзывов(-а))