Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

grcalc

GRcalc 1.0 — A graphical calculator written in Turbo Pascal (2002). Expression parser, math evaluator, BGI graphics renderer.

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

GRcalc 1.0

A graphical calculator written in Turbo Pascal (2002).

Type a mathematical expression, get a plot on a Cartesian plane. Inspired by the macOS Graphing Calculator and GNUplot.

Features

  • Expression parser (state machine → linked list AST)
  • Recursive evaluator with function composition (sin cos tan x works)
  • Real-time BGI graphics rendering with zoom
  • Supports: sin, cos, tan, cotan, asin, acos, atan, ln, exp, sqrt
  • Operators: +, -, *, / with bracket grouping
  • Multi-driver graphics: EGA/VGA, CGA, Hercules (linked into the executable)
  • Color-coded progress bar: blue (defined), red (out-of-bounds), gray (undefined)
  • Error reporting modeled on C's perror()

Screenshots

y = cos(e(x)) at 60× zoom:

cos(e(x))

y = ln(cos(x*x)) + atan(x) at 90× zoom:

ln(cos(x*x)) + atan(x)

Architecture

Main program flow:

Main flowchart

Expression parser state machine:

Parser flowchart

Building

Requires Borland Turbo Pascal 7.0. The BGI driver object files (EGAVGA.OBJ, CGA.OBJ, HERC.OBJ) are included and linked directly into the executable.

A pre-built GRCALC.EXE is provided in bin/.

Documentation

Full documentation (24 pages, in Italian) is in doc/grcalc-doc.rtf. Flowcharts were drawn in CorelDRAW (doc/flux.cdr).

License

Copyright (C) 2002 Marcello Barnaba vjt@openssl.it

Licensed under the GNU General Public License v2 or later.