Skip to content

A calculator using Peano arithmetic, implemented in Scala.

Notifications You must be signed in to change notification settings

benjamindkilleen/peano

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

peano

A (hopefully) type-sound interpretter for numeric and boolean computations, evaluated with Peano arithmetic, implemented in Scala.

Run

peano depends on sbt, Scala's project management tool. Once you have sbt installed, run

sbt run

to start the interpretter. It will automatically compile the project.

We recommend using rlwrap, which enables a Unix-like command line editor inside the interpretter, like so:

rlwrap sbt run

Usage

peano uses an intuitive calculator syntax for computations: computations can be written in the usual way. For example

  • 1 + 1
  • 1.5*3.7
  • 1.6 % -(2.7 + 1)

We also provide several built-in functions for convenience. For example

  • div (4 + 4) 2 divides 4 + 4 by 2.
  • gcd 24 16 gives the greatest common denominator.

peano represents terms somewhat opaquely according to the Peano arithmetic. There are four "types" in the pure peano language: Bools, Naturals, Integers, and Rationals:

  • A Bool is either "true" T or "false" F.
  • A Natural n is either "zero" Zor the "successor" of another natural S n.
  • An Integer consists of a Bool "is negative" and a Natural "absolute value."
  • A Rational consists of an Integer "numerator" and a natural "denominator"

About

A calculator using Peano arithmetic, implemented in Scala.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages