Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
/ inspect Public archive

Simple spreadsheet formula parser / REPL, written in C++, using Ragel and Lemon

License

Notifications You must be signed in to change notification settings

tristanpenman/inspect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inspect

Overview

Inspect is a very simple spreadsheet application.

This project is essentially experimental code - I wrote it while learning how to use Ragel and Lemon to build a parser. The build system was hacked together pretty quickly so that it would work on Mac. It should compile cleanly on Linux systems, but I have not tested this recently.

Dependencies

Build dependencies (these can be installed using a package manager such as 'apt' or 'brew'):

Third-party libraries:

  • googletest (for unit tests only, included in 'vendor' directory)

Build

Clone the repo, including submodules (googletest):

git clone --recurse-submodules [email protected]:tristanpenman/inspect.git
cd inspect

Inspect is built using CMake. The recommended approach is to create a build directory, and to run 'cmake' from there. For example:

mkdir build
cd build
cmake ..
make

For Windows... you're on your own.

Usage

This project includes a miniature REPL (inspect_console) for interacting with a sheet. A sheet is really just a collection of cells that can be identified using typical spreadsheet addresses (e.g. A1, B2, C12, etc).

If you followed the build instructions above, you can start the REPL using:

./inspect_console

You'll be greeted with a > prompt, where you can assign formulas to cells. After each assignment, the current state of the sheet will be printed out, e.g.:

> A1 = 1
[1,1]: 1
> A2 = A1
[1,1]: 1
[1,2]: 1
> B3 = A2 * 2
[1,1]: 1
[1,2]: 1
[2,3]: 2
> B4 = B3 + A1 * 2
[1,1]: 1
[1,2]: 1
[2,3]: 2
[2,4]: 4
>

You can force the parser to treat a formula as a literal value, using an apostrophe ' instead of equals =:

> A1 'This is my literal
[1,1]: This is my literal
>

And you can inspect the formula and value of an individual cell:

> A1 = 2
[1,1]: 2
> A2 = A1 + 1
[1,1]: 2
[1,2]: 3
> A2
A2 = A1 + 1 = 3
>

The REPL will tell you if your input is invalid:

> Some invalid input
Error: Invalid input.
>

Project structure

  * etc          Contains lemon parser template
  * src          Source files
  * test         Test source files
  * vendor       Third party library dependencies

License

Inspect is licensed under the Simplified BSD License. See the LICENSE file for more information.

About

Simple spreadsheet formula parser / REPL, written in C++, using Ragel and Lemon

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published