commit 53d825cfe65064d04cac1ba31ae7d05c94d43d77
parent 364689aa69f11fd058b1f9295b36996d9d99e284
Author: Zack Newman <zack@philomathiclife.com>
Date: Tue, 2 May 2023 12:13:06 -0600
fix comments dealing with mod as lower precedence than add
Diffstat:
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lang.tex b/lang.tex
@@ -20,7 +20,7 @@ Define the production rules, \(P\), as the following:
\item \(expr \rightarrow empty\ |\ quit\ |\ eval\ |\ store\)
\item \(empty \rightarrow ws\)
\item \(quit \rightarrow ws\ q\ ws\)
- \item \(eval\rightarrow ws\ modulo\ ws\)
+ \item \(eval\rightarrow ws\ add\ ws\)
\item \(store\rightarrow ws\ s\ ws\)
\item \(add \rightarrow add\ ws\ +\ ws\ mult\ |\ add\ ws\ -\ ws\ mult\ |\ mult\)
\item \(mult \rightarrow mult\ ws\ *\ ws\ neg\ |\ mult\ ws\ /\ ws\ neg\ |\ mult\ ws\ mod\ ws\ neg\ |\ neg\)
diff --git a/src/lib.rs b/src/lib.rs
@@ -799,7 +799,7 @@ impl<'input, 'cache, 'prev, 'scratch> Evaluator<'input, 'cache, 'prev, 'scratch>
})
}
/// Generates a random 64-bit integer.
- /// This function is based on modulo expressions.
+ /// This function is based on add expressions.
/// This is the last terminal expression attempted when needing
/// a terminal expression; as a result, it is the only terminal expression
/// that does not return an `Option`.
@@ -924,7 +924,7 @@ impl<'input, 'cache, 'prev, 'scratch> Evaluator<'input, 'cache, 'prev, 'scratch>
}
}
/// Rounds a value to the specified number of fractional digits.
- /// This function is based on modulo expressions.
+ /// This function is based on add expressions.
#[inline]
fn get_round(&mut self) -> Result<Option<Ratio<BigInt>>, LangErr> {
let Some(b) = self.utf8.get(self.i..self.i.saturating_add(6)) else {
@@ -974,7 +974,7 @@ impl<'input, 'cache, 'prev, 'scratch> Evaluator<'input, 'cache, 'prev, 'scratch>
}
}
/// Evaluates absolute value expressions as defined in the calc language.
- /// This function is based on modulo expressions.
+ /// This function is based on add expressions.
#[inline]
fn get_abs(&mut self) -> Result<Option<Ratio<BigInt>>, LangErr> {
let Some(b) = self.utf8.get(self.i) else {
@@ -1034,7 +1034,7 @@ impl<'input, 'cache, 'prev, 'scratch> Evaluator<'input, 'cache, 'prev, 'scratch>
}
}
/// Evaluates parenthetical expressions as defined in the calc language.
- /// This function is based on modulo expressions.
+ /// This function is based on add expressions.
#[inline]
fn get_par(&mut self) -> Result<Option<Ratio<BigInt>>, LangErr> {
let Some(b) = self.utf8.get(self.i) else {