Skip to content

Dobefu/pratt-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pratt Parser

Quality Gate Status Go Report Card

Usage

  • Run the application with the expression you wish to parse as the first argument, e.g.:

    go run main.go "1 + 1"

Supported constants

  • PI - π
  • TAU - τ (2π)
  • E - Euler's number
  • PHI - φ Golden ratio
  • LN2 - Natural logarithm of 2
  • LN10 - Natural logarithm of 10

Supported functions

  • abs(x) - Absolute value of x
  • sin(x) - Sine value of x
  • cos(x) - Cosine value of x
  • tan(x) - Tangent value of x
  • sqrt(x) - Square root
  • round(x) - Round x to the nearest integer value
  • floor(x) - Round x down to the nearest integer value
  • ceil(x) - Round x up to the nearest integer value
  • min(x, y) - Get the smallest of the values provided
  • max(x, y) - Get the largest of the values provided

About

A coding excercise to create a Pratt Parser from scratch

Topics

Resources

License

Stars

Watchers

Forks