From e41b536b0d7d6993cd233ebba275de345c2c6f82 Mon Sep 17 00:00:00 2001 From: Matt Kantor Date: Fri, 13 Jun 2025 15:29:09 -0400 Subject: [PATCH 1/3] Run `npm pkg fix` --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 307a4e8..8049fd4 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "type": "module", "bin": { - "please": "./please" + "please": "please" }, "scripts": { "0": "node ./dist/language/cli/0.js", From a7778753e0d4eaf94e1d3497383d8ccac2941e22 Mon Sep 17 00:00:00 2001 From: Matt Kantor Date: Tue, 24 Jun 2025 15:22:15 -0400 Subject: [PATCH 2/3] Tweak fibonacci example --- examples/.snapshot | 6 +++--- examples/fibonacci.plz | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/.snapshot b/examples/.snapshot index 906d1a1..d6372df 100644 --- a/examples/.snapshot +++ b/examples/.snapshot @@ -3,7 +3,7 @@ exports[`examples > fibonacci.plz --input="not a number" > stderr 1`] = ` `; exports[`examples > fibonacci.plz --input="not a number" > stdout 1`] = ` -"input must be a natural number" +"--input must be a natural number" `; @@ -12,7 +12,7 @@ exports[`examples > fibonacci.plz --input=-1 > stderr 1`] = ` `; exports[`examples > fibonacci.plz --input=-1 > stdout 1`] = ` -"input must be a natural number" +"--input must be a natural number" `; @@ -57,7 +57,7 @@ exports[`examples > fibonacci.plz > stderr 1`] = ` `; exports[`examples > fibonacci.plz > stdout 1`] = ` -"missing input argument" +"missing --input argument" `; diff --git a/examples/fibonacci.plz b/examples/fibonacci.plz index 0080f70..6e1825e 100644 --- a/examples/fibonacci.plz +++ b/examples/fibonacci.plz @@ -1,21 +1,22 @@ { fibonacci: n => @if { - condition: :n < 2 + :n < 2 then: :n else: :fibonacci(:n - 1) + :fibonacci(:n - 2) } input: @runtime { context => + // read --input from command-line arguments :context.arguments.lookup(input) } output: :input match { - none: _ => "missing input argument" + none: _ => "missing --input argument" some: input => @if { - condition: :natural_number.is(:input) + :natural_number.is(:input) then: :fibonacci(:input) - else: "input must be a natural number" + else: "--input must be a natural number" } } }.output From 4cb4bc2845d15dd13737b1951e2ed823810db688 Mon Sep 17 00:00:00 2001 From: Matt Kantor Date: Tue, 24 Jun 2025 15:22:59 -0400 Subject: [PATCH 3/3] Trivially tweak atom parsers --- src/language/parsing/atom.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/language/parsing/atom.ts b/src/language/parsing/atom.ts index adf87a7..18edad1 100644 --- a/src/language/parsing/atom.ts +++ b/src/language/parsing/atom.ts @@ -11,6 +11,7 @@ import { zeroOrMore, } from '@matt.kantor/parsing' import { + arrow, atSign, backslash, closingBlockCommentDelimiter, @@ -32,6 +33,7 @@ import { whitespace } from './trivia.js' export type Atom = string const atomComponentsRequiringQuotation = [ + arrow, atSign, backslash, closingBlockCommentDelimiter, @@ -46,10 +48,8 @@ const atomComponentsRequiringQuotation = [ singleLineCommentDelimiter, whitespace, - // Reserved to allow symbols like `=>` to not be conflated with atoms: - literal('='), - // Reserved for future use: + literal('='), literal('['), literal(']'), literal('#'),