A robust, arbitrary-precision command-line calculator built using modern compiler-design principles.
This application was developed as a milestone project within the Hyperskill / JetBrains Academy Kotlin Core curriculum.
- Course Project Page: https://hyperskill.org/projects/88
- My Hyperskill Profile: https://hyperskill.org/profile/629496713
- Lexical Analysis: Built a custom stateful
Tokenizerutilizing regular expressions to cleanly parse raw infix mathematical strings. - Type-Safe Domain Modeling: Leveraged Kotlin
sealed classarchitectures and data objects to represent tokens and exceptions safely at compile-time. - Shunting-Yard Algorithm: Implemented Dijkstra's Shunting-Yard algorithm using an
ArrayDequestack to seamlessly convert Infix expressions to Postfix (RPN) notation. - Arbitrary Precision: Built completely atop Java's
BigIntegerto support infinitely large numbers and prevent overflow runtime bugs. - Smart Sign Resolution: Dynamically processes and normalizes complex chains of unary operators (e.g., resolving
-5 + (---3 * 2)accurately).
- Kotlin (JVM)
- Java Math API (
BigInteger)
- Open the project root folder in IntelliJ IDEA.
- Run the
main()function insideCalculator.kt. - Type in
/helpfor instructions.