Skip to content

J-Simkin/TerminalGraphing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Terminal ASCII Grapher

A simple terminal graphing application that parses expressions including the variable x and plots them.

To try:

  • git clone https://github.com/J-Simkin/TerminalGraphing.git

  • cd TerminalGraphing

To build, CMake is required along with a C++ 17 compiler in your path for CMake to find.

Windows:

  • Download from https://cmake.org/download/
  • If you have previoulsy compiled C++ in Visual Studio it is likely MSVC is not in your path already even if it is installed. An easy way to run without adding it to your path is to find the "x64_x86 Cross Tools Command Prompt for VS 2022" in the start menu and use this instead of cmd/powershell.
  • If you have not used C++ before but have visual studio, you will need to install MSVC (inlcuded within the group of tools: Desktop Development with C++)
  • You may also use WSL instead

Linux:

  • sudo apt install cmake
    For Debian/Ubuntu if you do not already have a C++ compiler:
  • sudo apt update
  • sudo apt install build-essential

macOS:

  • brew install cmake

Then within the cloned repo:

  • mkdir build
  • cd build
  • cmake ..
  • cmake --build .

Then finally to run, within build/ :

  • .\ASCIIGraphing

Or for Windows:

  • .\Debug\ASCIIGraphing.exe

Once running, simply type out an expression involving some x's and press enter.

Example expressions
  • 4 * log(x) - 8 + 1.5 * x

  • 0.8*x^2 - 5*x - 4

Warning, multiplication by writing terms adjacent to eachother is not supported, ie to multiply two numbers we must write 4 * sin(x) and not just 4sin(x).

Use of AI

This is a project I built alongside AI to learn c++. The choices made such as having a functional style lexer and parser as well as the shape of the AST and how we evaluate the functions were mine. I also wrote the code within the main.cpp file and had to modify the lexer and parser myself when ChatGPT forgot that the variable "x" needed to handled; the code it generated would have treated "x" as a function and then gotten confused in the parser when it wasn't followed by parentheses.

Debugging problems from trying to get project to run

Ensure that you open your terminal after all dependencies are installed else they may not be found within your terminal.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors