Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Calculator implementation in C++ using Context Free Grammar
New
Rating: 5.0 out of 5(1 rating)
245 students

Calculator implementation in C++ using Context Free Grammar

Hands on Calculator implementation in C++ using Expression Grammar rules
Last updated 4/2026
English

What you'll learn

  • theory behind evaluation of arithmetic expressions
  • operator precedence, operator associativity
  • Calculator implementation in C++ using Expression Grammar
  • Convert Expression Grammar to C++ code
  • Project picked from Chapter 6 of the book "Programming Principles and Practice in C++" by Bjarne Stroustrup

Course content

2 sections9 lectures57m total length
  • Introduction to Calculator project & Expression Grammar6:31
  • Expression Parsing6:00
  • 'Token' abstraction4:18

Requirements

  • Basic knowledge of C++ programming
  • Theoretical knowledge of Context Free Grammar

Description

In this course we will do live coding of:

1. Calculator implementation in C++ using Expression Grammar (context free grammar)

I have referred to Chapter 6 of the book "Programming: Principles and Practice using C++" by Bjarne Stroustrup.

I have tried to share my learning experience while converting Expression Grammar into the Calculator program using C++. Hope, it will help people like me to understand the concepts in a faster way and help to resolve doubts.

While coding the program, I am also sharing the thought process which goes on in developers mind. We will face compile-time, run-time errors and then we will resolve them using gdb debugger.

Implementing Expression Grammar in C++ also gives us a bit of understanding on how the parsing works.

In this course we will do hands-on programming:

  1. Theory of arithmetic expression Calculator:

    1. Theory of Expression Grammar (CFG)

    2. Expression Parsing

    3. left recursion, removal of left recursion

    4. Token & Token Stream class abstraction

  2. Coding:

    1. expression(), term(), primary(), function implementations

    2. TokenStream get() and putback() implementations

    3. debugging with gdb

    4. Conclusion

    Different C++ & programming concepts used during software development:

    classes, public & private variables, functions, constructors, operator precedence, operator associativity, left recursion, removal of left recursion, segmentation fault, debugging with gdb.

Who this course is for:

  • Entry level C or C++ Software Engineers
  • Mid level C or C++ Software Engineers