From 8f2d0f06f0f8adb27a20f4da06182c5b56ab99bd Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Fri, 22 Apr 2022 12:42:05 -0400 Subject: [PATCH] CR comments; other things --- packages/website/docs/Internal/Grammar.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/website/docs/Internal/Grammar.md b/packages/website/docs/Internal/Grammar.md index 954ee95b..d3b4f0a4 100644 --- a/packages/website/docs/Internal/Grammar.md +++ b/packages/website/docs/Internal/Grammar.md @@ -1,6 +1,5 @@ --- title: Grammar -urlcolor: blue author: - Quinn Dougherty --- @@ -13,17 +12,20 @@ _In all likelihood the reference will have to be debugged as we see what tests p - `` ::= `[-]? [0-9]+ (.[0-9]+)? | [-]? [0-9]+ (.[0-9]+)? [e] [-]? [0-9]+` - `` ::= `[a-zA-Z]+ [a-zA-Z0-9]?` -- `` ::= `(normal(, ) | beta(, ) | triangular(, , ) | cauchy(, ) | lognormal(, )) | uniform(, ) | to | exponential()` +- `` ::= `normal(, ) | beta(, ) | triangular(, , ) | cauchy(, ) | lognormal(, )) | uniform(, ) | to | exponential()` +- `` ::= `true | false` ## Expressions +The following gives no typing information. You can obey the grammar and still write nonsensical code. + Think of javascript's list unpacking notation to read our variable-argument function `mixture`. ``` - ::= + | - | .+ | .- | | sample() | mixture(..., ) | mx(..., ) | exp() | log(, ?) | log10() | dotLog(, ?) | normalize() + ::= + | - | .+ | .- | | sample() | mixture(..., ) | mx(..., ) | exp() | log(, ?) | log10() | dotLog(, ?) | normalize() | isNormalized() | pdf(, ) | cdf(, ) | inv(, ) | mean() | truncate(, , ) | truncateLeft(, ) | truncateRight(, ) ::= * | | / | .* | | ::= ^ | .^ | - ::= | | | ( ) + ::= | | | | ( ) ``` ## Data structures @@ -36,9 +38,9 @@ Think of javascript's list unpacking notation to read our variable-argument func ## Statements ``` - ::= | - ::= = - ::= () = + ::= | + ::= = + ::= () = ``` ## A squiggle file @@ -47,7 +49,7 @@ To be valid and raise no errors as of current (apr22) interpreter, ``` ::= ; | \n - ::= | | | ... + ::= | | | ... ``` This isn't strictly speaking true; the interpreter allows expressions outside of the final line.