My programming bloghttps://blog.palit.me/Thu, 22 Oct 2020 00:00:00 +05304 ways to build a simple calculator in Python - Part 3https://blog.palit.me/4-ways-calculator-part-3.html<p>In this concluding part of the series, I will build an <em>abstract syntax tree</em> or
AST. An AST holds the information present in the arithmetic expression and can be
evaluated to yield the result. It is built from grammar rules just like the translator
in part 2 and evaluated using …</p>Debashish PalitThu, 22 Oct 2020 00:00:00 +0530tag:blog.palit.me,2020-10-22:/4-ways-calculator-part-3.htmlposts4 ways to build a simple calculator in Python - Part 2https://blog.palit.me/4-ways-calculator-part-2.html<p>In this part of the series, I will build the calculator as a translator. The translator will
evaluate the arithmetic expression according to a set of rules. It will consist of a lexer
that will produce a stream of tokens from the input, and a parser that will check
the …</p>Debashish PalitWed, 12 Aug 2020 00:00:00 +0530tag:blog.palit.me,2020-08-12:/4-ways-calculator-part-2.htmlposts4 ways to build a simple calculator in Python - Part 1https://blog.palit.me/4-ways-calculator-part-1.html<p>The internet abounds with tutorials on programming projects like building
a calculator, for instance. The focus is often on the GUI aspects, ignoring
the complexities of expression evaluation. Mathematical expressions are usually
evaluated by the <code>eval</code> function. This is not a safe method if arbitrary input
is allowed. In this …</p>Debashish PalitMon, 13 Apr 2020 00:00:00 +0530tag:blog.palit.me,2020-04-13:/4-ways-calculator-part-1.htmlpostsHeap data structures in CShttps://blog.palit.me/heap-data-structures-in-cs.html<p>In this post, I am going to tell you about different heap data structures that are
common in Computer Science. I will start with the basic heap structure, i.e. the
binary heap, and then discuss binomial and Fibonacci heaps. The code for each data
structure is in Python. For …</p>Debashish PalitSat, 22 Feb 2020 00:00:00 +0530tag:blog.palit.me,2020-02-22:/heap-data-structures-in-cs.htmlpostsMore on the Python tracebackhttps://blog.palit.me/more-on-the-python-traceback.html<p>This post adds to the content of the fine article by Real Python titled
<a href="https://realpython.com/python-traceback/" target="_blank">
Understanding the Python traceback</a>. It expands on the topic of chained
exceptions and explains what a traceback object is.</p>
<p>First, to repeat for convenience what has been said in that article: when an
exception occurs while …</p>Debashish PalitThu, 24 Oct 2019 00:00:00 +0530tag:blog.palit.me,2019-10-24:/more-on-the-python-traceback.htmlposts