aetg

command module
v0.0.0-...-7188496 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2020 License: MIT Imports: 7 Imported by: 0

README

aetg

Inspired by this video.

aetg is essentially just a simple calculator with an annoying syntax.

This is mainly just a small project I made to get experience with making trees (and parsing) in Go.

Usage

aetg parses arithmetic expressions into a tree of sub expressions that it then evaluates.

Since I am new to writing lexers/parsers, aetg uses a very strict format to notate expressions that is easy to tokenize.

Run the compiled aetg binary to enter a shell in which you can type expressions.

Notation is as follows:

(<sub expr> operator <sub expr>)

Examples:

(5 * (3 - 6))

(((8.11 + -7) ^ 3) - ((2 | 4) * (5.23 / (5 % 2))))

The following operators are supported:

  • + Addition
  • - Subtraction
  • * Multiplication
  • / Division
  • ^ Exponentiation
  • % Modulus
  • | Radical ((2 | number) for square root, etc.)
Flags
  • --version Display version information
  • --verbose Print expressions after parsing
  • --file <filepath> Read and run an expression from a file
  • --expr <expression> Run a specific expression without going into the shell

Installation

It's just a single binary.

You can compile with go build.

A Linux binary is provided.

License

All files are licensed under the MIT License

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL