14 Commits

Author SHA1 Message Date
Arkaprabha Chakraborty
7e2b50610b chore: update README.md 2024-12-01 01:31:07 +05:30
Arkaprabha Chakraborty
cfacecff63 feat: add cover image 2024-11-30 02:45:05 +05:30
Arkaprabha Chakraborty
2fef1ac20f chore: change the root header 2024-11-17 02:51:58 +05:30
Arkaprabha Chakraborty
94454a58b5 Correct a minor spelling mistake 2024-01-23 06:36:37 +05:30
Arkaprabha Chakraborty
cf37a5c1e4 Refactor README.md for Clarity and Detail
Commit details:
- Update the title to better reflect the functionality of the program.
- Add a section outlining the features of the arithmetic expression evaluator.
- Expand the AST Node Hierarchy section to provide more detailed information about each node type.
- Include examples to demonstrate the usage of the program with simple expressions.
- Add a Concepts section to highlight the Object-Oriented Programming principles used in the implementation.
- Include a Memory Management section to explain the choices made regarding smart pointers, dynamic memory allocation, and virtual destructors.
- Expand the Testing section to provide a clearer structure of the test harness, including individual test functions and a test runner.
- Add a section on how to enable and disable tests using the ENABLE_TESTS macro.
- Provide instructions for building, running tests, and cleaning the project using make commands.
- Update the Contributing section to encourage contributions and provide guidance on coding style and test cases.
- Clarifie the license information in the License section.
2024-01-22 10:24:28 +05:30
Arkaprabha Chakraborty
faa06b1f87 Remove Deprecated 'run' Target from Makefile and Update 'test' Target
Commit details:
- Removed the deprecated 'run' target from the Makefile, as it was redundant and not needed for the current project structure.
- Minor improvements and cleanup in the Makefile.
2024-01-22 09:32:21 +05:30
Arkaprabha Chakraborty
cb2a43df69 Add AST Node Unit Tests and Refactor Expression Evaluation
Commit details:
- Add unit tests for AST nodes, including Constant, Identifier, UnaryPlus, UnaryMinus, Add, Subtract, Multiply, Divide, and Power.
- Include test cases for evaluating expressions with various node types and operations.
- Introduce a test harness to ensure that each node's `evaluate` method produces the expected results.
- Update the `main` function to use the new `runTests` function when the `--run-tests` option is provided.
- Refactor the existing test function (`runTest`) into individual test functions for better organization and readability.
- Improve the help message to reflect the correct option name (`--run-tests`).
2024-01-22 09:29:50 +05:30
Arkaprabha Chakraborty
0da96101a0 Update README.md with Dependencies and Running Tests section
Commit details:
- Added a 'Dependencies' section listing GNU Make and Clang.
- Introduced a 'Running Tests' section with a test expression and corresponding C++ code.
- Demonstrated a complex expression and its expected result.
2024-01-22 07:14:34 +05:30
Arkaprabha Chakraborty
08c5f9712a Update Makefile for build improvements and testing
Commit details:
- Set optimization level to O3 and include pedantic warnings in CXXFLAGS.
- Introduce separate build and source directories for better project organization.
- Add a target to run tests with the ENABLE_TESTS macro.
- Improve the 'all' target to create the build directory before building the executable.
- Introduce a 'rebuild' target for cleaning and rebuilding the project.

Changes made in Makefile:
- Update CXXFLAGS with -O3 and -pedantic.
- Introduce BUILD_DIR and SRC_DIR variables for better organization.
- Modifie SOURCE to point to the source file within the source directory.
- Update EXECUTABLE to exclude the file extension.
- Update 'all' target to create the build directory.
- Add 'test' target to run tests with the ENABLE_TESTS macro.
- Add 'rebuild' target for cleaning and rebuilding the project.
2024-01-22 07:11:49 +05:30
Arkaprabha Chakraborty
dee7372ae4 Add build directory to .gitignore
Changes made in .gitignore:
- Add 'build/' to exclude generated build files.
2024-01-22 07:09:30 +05:30
Arkaprabha Chakraborty
69bc5b4aa1 Create ast.cxx for AST implementation and tests
Commit details:
- Add new file ast.cxx with ASTNode, Identifier, Divide, Multiply, Subtract, Power classes.
- Include necessary headers and static initialization of variableTable in Identifier class.
- Add a test function runTest() for evaluating a complex expression.
- Add printHelpMessage() function for displaying program usage.
- Update main function to handle "--run-test" argument.
2024-01-22 07:07:30 +05:30
Arkaprabha Chakraborty
7b5eb1e26d Rename main.cxx to ast.hxx
Commit details:
- Rename main.cxx to src/ast.hxx to better reflect its content.
- Update include statements in the renamed file.
- Remove unnecessary include <cstring> statement from ast.hxx.
- Remove redundant implementation of Power::evaluate() in ast.hxx.
2024-01-22 07:06:48 +05:30
Arkaprabha Chakraborty
6c313ae3dd Refactor AST Node Hierarchy and Enable Test Execution
Commit details:
- Refactor the Abstract Syntax Tree (AST) node hierarchy in `main.cxx` for improved memory management and ownership semantics.
- Introduce smart pointers (`std::unique_ptr`) for managing ownership of AST nodes, eliminating manual memory management.
- Add getter functions to access operands in Unary and Binary nodes.
- Implemente functions to release ownership of operands in Unary and Binary nodes.
- Replace manual deletion of operands in the destructor with default virtual destructors for Unary and Binary nodes.
- Add a conditional compilation block (`#ifdef ENABLE_TESTS`) to enable testing functionality.
- Create a test expression in the `runTest` function to evaluate a complex mathematical expression.
- Enable test execution using the `--run-test` command-line option.
- Provide a help message for the main program, outlining available options.
2024-01-22 07:00:48 +05:30
Arkaprabha Chakraborty
49617b7822 Initial commit 2024-01-20 07:34:29 +05:30