From 433e08ff1ffa8c60dba825df14681f73c97597ad Mon Sep 17 00:00:00 2001 From: Aidan Jones Date: Wed, 12 Nov 2025 13:35:15 -0600 Subject: [PATCH 1/6] chore: rename import aliases --- apps/parser/deno.jsonc | 2 +- apps/parser/main.ts | 2 +- apps/parser/test/end-to-end/parsing.test.ts | 2 +- apps/parser/test/integration/comments.test.ts | 2 +- apps/parser/test/integration/control-flow.test.ts | 2 +- apps/parser/test/integration/data-types.test.ts | 2 +- apps/parser/test/integration/expressions.test.ts | 2 +- apps/parser/test/integration/keywords.test.ts | 2 +- apps/parser/test/utils/mod.ts | 2 +- deno.jsonc | 2 +- scripts/generate/deno.jsonc | 2 +- scripts/generate/main.ts | 4 ++-- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/apps/parser/deno.jsonc b/apps/parser/deno.jsonc index 5be229d..cc4a4ce 100644 --- a/apps/parser/deno.jsonc +++ b/apps/parser/deno.jsonc @@ -1,5 +1,5 @@ { - "name": "@calvin-lang/parser", + "name": "@encode/parser", "version": "0.1.0", "exports": { diff --git a/apps/parser/main.ts b/apps/parser/main.ts index 6bd10e0..ea09131 100644 --- a/apps/parser/main.ts +++ b/apps/parser/main.ts @@ -1,4 +1,4 @@ -import { CalvinLexer, CalvinParser, CalvinPrinter, Globals } from '@calvin-lang/parser/lib'; +import { CalvinLexer, CalvinParser, CalvinPrinter, Globals } from '@encode/parser/lib'; import { parseArgs } from '@std/cli/parse-args'; import { join, toFileUrl } from '@std/path'; diff --git a/apps/parser/test/end-to-end/parsing.test.ts b/apps/parser/test/end-to-end/parsing.test.ts index 15ace8d..d3c5276 100644 --- a/apps/parser/test/end-to-end/parsing.test.ts +++ b/apps/parser/test/end-to-end/parsing.test.ts @@ -1,4 +1,4 @@ -import * as TestSubject from '@calvin-lang/parser/lib'; +import * as TestSubject from '@encode/parser/lib'; import { bold, dim, yellow } from '@std/fmt/colors'; import { walk } from '@std/fs'; import { toFileUrl } from '@std/path'; diff --git a/apps/parser/test/integration/comments.test.ts b/apps/parser/test/integration/comments.test.ts index 85f2729..f8d2cae 100644 --- a/apps/parser/test/integration/comments.test.ts +++ b/apps/parser/test/integration/comments.test.ts @@ -1,4 +1,4 @@ -import * as TestSubject from '@calvin-lang/parser/lib'; +import * as TestSubject from '@encode/parser/lib'; import { assert, assertEquals } from '@std/assert'; import { performParsingTestCase, useGlobalSettings } from '@/test/utils/mod.ts'; diff --git a/apps/parser/test/integration/control-flow.test.ts b/apps/parser/test/integration/control-flow.test.ts index a678ff3..6145438 100644 --- a/apps/parser/test/integration/control-flow.test.ts +++ b/apps/parser/test/integration/control-flow.test.ts @@ -1,4 +1,4 @@ -import * as TestSubject from '@calvin-lang/parser/lib'; +import * as TestSubject from '@encode/parser/lib'; import { assert, assertEquals, assertGreater } from '@std/assert'; import { performParsingTestCase, useGlobalSettings } from '@/test/utils/mod.ts'; diff --git a/apps/parser/test/integration/data-types.test.ts b/apps/parser/test/integration/data-types.test.ts index bac4808..c72b631 100644 --- a/apps/parser/test/integration/data-types.test.ts +++ b/apps/parser/test/integration/data-types.test.ts @@ -1,4 +1,4 @@ -import * as TestSubject from '@calvin-lang/parser/lib'; +import * as TestSubject from '@encode/parser/lib'; import { assert, assertEquals } from '@std/assert'; import { performParsingTestCase, useGlobalSettings } from '@/test/utils/mod.ts'; diff --git a/apps/parser/test/integration/expressions.test.ts b/apps/parser/test/integration/expressions.test.ts index 0d24bec..7010e47 100644 --- a/apps/parser/test/integration/expressions.test.ts +++ b/apps/parser/test/integration/expressions.test.ts @@ -1,4 +1,4 @@ -import * as TestSubject from '@calvin-lang/parser/lib'; +import * as TestSubject from '@encode/parser/lib'; import { assert, assertEquals, assertGreater } from '@std/assert'; import { performParsingTestCase, useGlobalSettings } from '@/test/utils/mod.ts'; diff --git a/apps/parser/test/integration/keywords.test.ts b/apps/parser/test/integration/keywords.test.ts index 42d4b13..49bd8e1 100644 --- a/apps/parser/test/integration/keywords.test.ts +++ b/apps/parser/test/integration/keywords.test.ts @@ -1,4 +1,4 @@ -import * as TestSubject from '@calvin-lang/parser/lib'; +import * as TestSubject from '@encode/parser/lib'; import { assert } from '@std/assert'; import { performParsingTestCase, useGlobalSettings } from '@/test/utils/mod.ts'; diff --git a/apps/parser/test/utils/mod.ts b/apps/parser/test/utils/mod.ts index f454dea..dea92ec 100644 --- a/apps/parser/test/utils/mod.ts +++ b/apps/parser/test/utils/mod.ts @@ -6,7 +6,7 @@ import { debug, Globals, type PrecedenceHandler, -} from '@calvin-lang/parser/lib'; +} from '@encode/parser/lib'; import type { ILexingResult } from 'chevrotain'; import type { FileCstChildren } from '@/generated/cst-types.ts'; diff --git a/deno.jsonc b/deno.jsonc index 785841e..f6074f6 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -2,7 +2,7 @@ "workspace": ["apps/*", "scripts/*", "packages/*"], "tasks": { - "generate": "deno run --allow-write @calvin-lang/generate", + "generate": "deno run --allow-write @encode/generate", "check": "deno run --allow-env --allow-run @biomejs/biome check", "fmt": "deno run --allow-env --allow-run --allow-write @biomejs/biome format --write" }, diff --git a/scripts/generate/deno.jsonc b/scripts/generate/deno.jsonc index 2f45f5c..41103b6 100644 --- a/scripts/generate/deno.jsonc +++ b/scripts/generate/deno.jsonc @@ -1,5 +1,5 @@ { - "name": "@calvin-lang/generate", + "name": "@encode/generate", "version": "0.1.0", "exports": { diff --git a/scripts/generate/main.ts b/scripts/generate/main.ts index b4b3c7c..8b04f74 100644 --- a/scripts/generate/main.ts +++ b/scripts/generate/main.ts @@ -1,4 +1,4 @@ -import { parser } from '@calvin-lang/parser/lib'; +import { parser } from '@encode/parser/lib'; import { parseArgs } from '@std/cli/parse-args'; import { bold, yellow } from '@std/fmt/colors'; import { generateDiagrams, generateTypes } from './mod.ts'; @@ -45,7 +45,7 @@ export async function main(): Promise { * to import files. This means we don't have to hard-code the exact path, only what package * export point we want to use. */ - const workspacePath = new URL(import.meta.resolve('@calvin-lang/parser/lib')); + const workspacePath = new URL(import.meta.resolve('@encode/parser/lib')); /** * An array of tasks to perform in parallel From 2bc26ff8e0f0c4573287bd528936fb2c4f01d401 Mon Sep 17 00:00:00 2001 From: Aidan Jones Date: Wed, 12 Nov 2025 13:38:18 -0600 Subject: [PATCH 2/6] chore(docs): rename in documentation/comments --- README.md | 2 +- apps/parser/test/utils/mod.ts | 8 ++++---- docs/Implementation.md | 2 +- docs/Type System.md | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e82a5d5..896c69e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# calvin-lang +# encode Personal project to make a C/JS-like programming language diff --git a/apps/parser/test/utils/mod.ts b/apps/parser/test/utils/mod.ts index dea92ec..bacd06e 100644 --- a/apps/parser/test/utils/mod.ts +++ b/apps/parser/test/utils/mod.ts @@ -12,13 +12,13 @@ import type { FileCstChildren } from '@/generated/cst-types.ts'; export interface TestCaseParameters { /** - * The parser to use for parsing Calvin code. + * The parser to use for parsing Encode code. * * **Note:** We choose not to instantiate this ourselves in case we want to inject something else, e.g. a shim or an experimental impl */ parser: CalvinParser; /** - * The parser to use for parsing Calvin code. + * The parser to use for parsing Encode code. * * **Note:** We choose not to instantiate this ourselves in case we want to inject something else, e.g. a shim or an experimental impl */ @@ -36,7 +36,7 @@ export interface TestCaseParameters { */ typeAnalyzer: CalvinTypeAnalyzer; /** - * The Calvin code to parse + * The Encode code to parse */ code: string; } @@ -54,7 +54,7 @@ export interface TestCaseOutputs { } /** - * Executes a standard procedure to parse Calvin code. + * Executes a standard procedure to parse Encode code. * * **Caveats:** * diff --git a/docs/Implementation.md b/docs/Implementation.md index 26995b7..03e128b 100644 --- a/docs/Implementation.md +++ b/docs/Implementation.md @@ -3,7 +3,7 @@ For now at least, the compiler will be implemented using a pre-existing parser-generator. Potential options: GNU Bison/YACC, ANTLR -In the future, the compiler will be written in Calvin itself. +In the future, the compiler will be written in Encode itself. ## Targets diff --git a/docs/Type System.md b/docs/Type System.md index 53d74f9..8fa038f 100644 --- a/docs/Type System.md +++ b/docs/Type System.md @@ -58,7 +58,7 @@ An arbitrary precision complex type can be expressed as `Complex`. ## References -Calvin has two reference types: references (`T&`), which will always be valid, +Encode has two reference types: references (`T&`), which will always be valid, and `Maybe` (`T?`), which can hold `null`. Both are implemented as pointers under the hood. ## Enums @@ -69,7 +69,7 @@ to `u8`. An enum can take strings as the underlying data type for easier printi ## Unions -Calvin provides tagged unions as a data type. Tagged unions will require either a programmer defined +Encode provides tagged unions as a data type. Tagged unions will require either a programmer defined enum to be specified, or will create a hidden enum under the hood to handle the options. If there is no enum provided, the types provided in the options must be distinct from each other (there is no such constraint when the programmer provides an enum). Accessing a member of a tagged union will From b142bf1c374332211d1bddf2a8325bd588cffe5b Mon Sep 17 00:00:00 2001 From: Aidan Jones Date: Wed, 12 Nov 2025 13:40:27 -0600 Subject: [PATCH 3/6] chore(parser): rename parser/lexer --- apps/parser/main.ts | 6 +++--- apps/parser/src/lexer.ts | 2 +- apps/parser/src/parser.ts | 4 ++-- apps/parser/test/end-to-end/parsing.test.ts | 2 +- apps/parser/test/integration/comments.test.ts | 2 +- apps/parser/test/integration/control-flow.test.ts | 2 +- apps/parser/test/integration/data-types.test.ts | 2 +- apps/parser/test/integration/expressions.test.ts | 2 +- apps/parser/test/integration/keywords.test.ts | 2 +- apps/parser/test/utils/mod.ts | 8 ++++---- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/parser/main.ts b/apps/parser/main.ts index ea09131..a839e1a 100644 --- a/apps/parser/main.ts +++ b/apps/parser/main.ts @@ -1,4 +1,4 @@ -import { CalvinLexer, CalvinParser, CalvinPrinter, Globals } from '@encode/parser/lib'; +import { EncodeLexer, EncodeParser, CalvinPrinter, Globals } from '@encode/parser/lib'; import { parseArgs } from '@std/cli/parse-args'; import { join, toFileUrl } from '@std/path'; @@ -32,11 +32,11 @@ export async function main(): Promise { const inputFile = await Deno.readTextFile(toFileUrl(join(Deno.cwd(), inputFilePath))); - const parser = new CalvinParser(); + const parser = new EncodeParser(); const printer = new CalvinPrinter(debugColors); - const lexingResult = CalvinLexer.tokenize(inputFile); + const lexingResult = EncodeLexer.tokenize(inputFile); // "input" is a setter which will reset the parser's state. parser.input = lexingResult.tokens; diff --git a/apps/parser/src/lexer.ts b/apps/parser/src/lexer.ts index c35268e..c6fc219 100644 --- a/apps/parser/src/lexer.ts +++ b/apps/parser/src/lexer.ts @@ -274,4 +274,4 @@ export const allTokens: TokenType[] = [ ERROR, ]; -export const CalvinLexer: Lexer = new Lexer(allTokens); +export const EncodeLexer: Lexer = new Lexer(allTokens); diff --git a/apps/parser/src/parser.ts b/apps/parser/src/parser.ts index 787c42c..faaeec6 100644 --- a/apps/parser/src/parser.ts +++ b/apps/parser/src/parser.ts @@ -1,7 +1,7 @@ import { type CstNode, CstParser, type ParserMethod } from 'chevrotain'; import * as Tokens from './lexer.ts'; -export class CalvinParser extends CstParser { +export class EncodeParser extends CstParser { constructor() { super(Tokens.allTokens); this.performSelfAnalysis(); @@ -184,7 +184,7 @@ export class CalvinParser extends CstParser { private type = this.RULE('type', () => this.CONSUME(Tokens.BASIC_TYPE)); } -export const parser: CalvinParser = new CalvinParser(); +export const parser: EncodeParser = new EncodeParser(); export const BaseCstVisitor: ReturnType = parser.getBaseCstVisitorConstructor(); export const BaseCstVisitorWithDefaults: ReturnType< diff --git a/apps/parser/test/end-to-end/parsing.test.ts b/apps/parser/test/end-to-end/parsing.test.ts index d3c5276..d1666c9 100644 --- a/apps/parser/test/end-to-end/parsing.test.ts +++ b/apps/parser/test/end-to-end/parsing.test.ts @@ -21,7 +21,7 @@ Deno.test('Loading & parsing', async (t) => { await t.step(file.name, async () => { using _globalSettings = useGlobalSettings({ debugTrees: false }); - const parser = new TestSubject.CalvinParser(); + const parser = new TestSubject.EncodeParser(); const precedenceHandler = new TestSubject.PrecedenceHandler(); diff --git a/apps/parser/test/integration/comments.test.ts b/apps/parser/test/integration/comments.test.ts index f8d2cae..ac67d00 100644 --- a/apps/parser/test/integration/comments.test.ts +++ b/apps/parser/test/integration/comments.test.ts @@ -5,7 +5,7 @@ import { performParsingTestCase, useGlobalSettings } from '@/test/utils/mod.ts'; Deno.test('Comment parsing #integration', async (t) => { using _globalSettings = useGlobalSettings({ debugTrees: true }); - const parser = new TestSubject.CalvinParser(); + const parser = new TestSubject.EncodeParser(); const precedenceHandler = new TestSubject.PrecedenceHandler(); diff --git a/apps/parser/test/integration/control-flow.test.ts b/apps/parser/test/integration/control-flow.test.ts index 6145438..95ada0a 100644 --- a/apps/parser/test/integration/control-flow.test.ts +++ b/apps/parser/test/integration/control-flow.test.ts @@ -5,7 +5,7 @@ import { performParsingTestCase, useGlobalSettings } from '@/test/utils/mod.ts'; Deno.test('Control flow parsing #integration', async (t) => { using _globalSettings = useGlobalSettings({ debugTrees: true }); - const parser = new TestSubject.CalvinParser(); + const parser = new TestSubject.EncodeParser(); const precedenceHandler = new TestSubject.PrecedenceHandler(); diff --git a/apps/parser/test/integration/data-types.test.ts b/apps/parser/test/integration/data-types.test.ts index c72b631..d19f42e 100644 --- a/apps/parser/test/integration/data-types.test.ts +++ b/apps/parser/test/integration/data-types.test.ts @@ -5,7 +5,7 @@ import { performParsingTestCase, useGlobalSettings } from '@/test/utils/mod.ts'; Deno.test('Data type parsing #integration', async (t) => { using _globalSettings = useGlobalSettings({ debugTrees: true }); - const parser = new TestSubject.CalvinParser(); + const parser = new TestSubject.EncodeParser(); const precedenceHandler = new TestSubject.PrecedenceHandler(); diff --git a/apps/parser/test/integration/expressions.test.ts b/apps/parser/test/integration/expressions.test.ts index 7010e47..a5694e2 100644 --- a/apps/parser/test/integration/expressions.test.ts +++ b/apps/parser/test/integration/expressions.test.ts @@ -5,7 +5,7 @@ import { performParsingTestCase, useGlobalSettings } from '@/test/utils/mod.ts'; Deno.test('Expression parsing #integration', async (t) => { using _globalSettings = useGlobalSettings({ debugTrees: true }); - const parser = new TestSubject.CalvinParser(); + const parser = new TestSubject.EncodeParser(); const precedenceHandler = new TestSubject.PrecedenceHandler(); diff --git a/apps/parser/test/integration/keywords.test.ts b/apps/parser/test/integration/keywords.test.ts index 49bd8e1..02468e0 100644 --- a/apps/parser/test/integration/keywords.test.ts +++ b/apps/parser/test/integration/keywords.test.ts @@ -5,7 +5,7 @@ import { performParsingTestCase, useGlobalSettings } from '@/test/utils/mod.ts'; Deno.test('Keyword parsing #integration', async (t) => { using _globalSettings = useGlobalSettings({ debugTrees: true }); - const parser = new TestSubject.CalvinParser(); + const parser = new TestSubject.EncodeParser(); const precedenceHandler = new TestSubject.PrecedenceHandler(); diff --git a/apps/parser/test/utils/mod.ts b/apps/parser/test/utils/mod.ts index bacd06e..99e9609 100644 --- a/apps/parser/test/utils/mod.ts +++ b/apps/parser/test/utils/mod.ts @@ -1,7 +1,7 @@ import { type BasePrinter, - CalvinLexer, - type CalvinParser, + EncodeLexer, + type EncodeParser, type CalvinTypeAnalyzer, debug, Globals, @@ -16,7 +16,7 @@ export interface TestCaseParameters { * * **Note:** We choose not to instantiate this ourselves in case we want to inject something else, e.g. a shim or an experimental impl */ - parser: CalvinParser; + parser: EncodeParser; /** * The parser to use for parsing Encode code. * @@ -66,7 +66,7 @@ export interface TestCaseOutputs { export function performParsingTestCase(params: TestCaseParameters): TestCaseOutputs { const { code, parser, printer, typeAnalyzer, precedenceHandler } = params; - const lexingResult = CalvinLexer.tokenize(code); + const lexingResult = EncodeLexer.tokenize(code); parser.input = lexingResult.tokens; const parserOutput = parser.file(); From f5de1ff05feeab5b0fc8ba05f1a4c06564da6227 Mon Sep 17 00:00:00 2001 From: Aidan Jones Date: Wed, 12 Nov 2025 13:41:42 -0600 Subject: [PATCH 4/6] chore(semantics): rename type analyzer --- apps/parser/src/visitors/semantics.ts | 2 +- apps/parser/test/end-to-end/parsing.test.ts | 2 +- apps/parser/test/integration/comments.test.ts | 2 +- apps/parser/test/integration/control-flow.test.ts | 2 +- apps/parser/test/integration/data-types.test.ts | 2 +- apps/parser/test/integration/expressions.test.ts | 2 +- apps/parser/test/integration/keywords.test.ts | 2 +- apps/parser/test/utils/mod.ts | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/parser/src/visitors/semantics.ts b/apps/parser/src/visitors/semantics.ts index 43baa7a..e79565c 100644 --- a/apps/parser/src/visitors/semantics.ts +++ b/apps/parser/src/visitors/semantics.ts @@ -142,7 +142,7 @@ export class Scope { } } -export class CalvinTypeAnalyzer +export class TypeAnalyzer extends BaseCstVisitor implements ICstNodeVisitor { diff --git a/apps/parser/test/end-to-end/parsing.test.ts b/apps/parser/test/end-to-end/parsing.test.ts index d1666c9..314958d 100644 --- a/apps/parser/test/end-to-end/parsing.test.ts +++ b/apps/parser/test/end-to-end/parsing.test.ts @@ -27,7 +27,7 @@ Deno.test('Loading & parsing', async (t) => { const printer = new TestSubject.CalvinPrinter(); - const typeAnalyzer = new TestSubject.CalvinTypeAnalyzer(); + const typeAnalyzer = new TestSubject.TypeAnalyzer(); const _testCaseOutputs = performParsingTestCase({ code: await Deno.readTextFile(toFileUrl(file.path)), diff --git a/apps/parser/test/integration/comments.test.ts b/apps/parser/test/integration/comments.test.ts index ac67d00..af1dad2 100644 --- a/apps/parser/test/integration/comments.test.ts +++ b/apps/parser/test/integration/comments.test.ts @@ -11,7 +11,7 @@ Deno.test('Comment parsing #integration', async (t) => { const printer = new TestSubject.JSONPrinter(false, null, 0); - const typeAnalyzer = new TestSubject.CalvinTypeAnalyzer(); + const typeAnalyzer = new TestSubject.TypeAnalyzer(); await t.step('line comment', () => { const { parserOutput, afterReorder } = performParsingTestCase({ diff --git a/apps/parser/test/integration/control-flow.test.ts b/apps/parser/test/integration/control-flow.test.ts index 95ada0a..7bec2a5 100644 --- a/apps/parser/test/integration/control-flow.test.ts +++ b/apps/parser/test/integration/control-flow.test.ts @@ -11,7 +11,7 @@ Deno.test('Control flow parsing #integration', async (t) => { const printer = new TestSubject.CalvinPrinter(); - const typeAnalyzer = new TestSubject.CalvinTypeAnalyzer(); + const typeAnalyzer = new TestSubject.TypeAnalyzer(); await t.step('simple if statement', () => { const { parserOutput, typeOutput } = performParsingTestCase({ diff --git a/apps/parser/test/integration/data-types.test.ts b/apps/parser/test/integration/data-types.test.ts index d19f42e..3ad67d6 100644 --- a/apps/parser/test/integration/data-types.test.ts +++ b/apps/parser/test/integration/data-types.test.ts @@ -11,7 +11,7 @@ Deno.test('Data type parsing #integration', async (t) => { const printer = new TestSubject.CalvinPrinter(); - const typeAnalyzer = new TestSubject.CalvinTypeAnalyzer(); + const typeAnalyzer = new TestSubject.TypeAnalyzer(); await t.step('real number literal', () => { const { parserOutput } = performParsingTestCase({ diff --git a/apps/parser/test/integration/expressions.test.ts b/apps/parser/test/integration/expressions.test.ts index a5694e2..cd2293b 100644 --- a/apps/parser/test/integration/expressions.test.ts +++ b/apps/parser/test/integration/expressions.test.ts @@ -11,7 +11,7 @@ Deno.test('Expression parsing #integration', async (t) => { const printer = new TestSubject.CalvinPrinter(); - const typeAnalyzer = new TestSubject.CalvinTypeAnalyzer(); + const typeAnalyzer = new TestSubject.TypeAnalyzer(); await t.step('simple expression', () => { const { parserOutput, precOutput } = performParsingTestCase({ diff --git a/apps/parser/test/integration/keywords.test.ts b/apps/parser/test/integration/keywords.test.ts index 02468e0..ab9083b 100644 --- a/apps/parser/test/integration/keywords.test.ts +++ b/apps/parser/test/integration/keywords.test.ts @@ -11,7 +11,7 @@ Deno.test('Keyword parsing #integration', async (t) => { const printer = new TestSubject.CalvinPrinter(); - const typeAnalyzer = new TestSubject.CalvinTypeAnalyzer(); + const typeAnalyzer = new TestSubject.TypeAnalyzer(); await t.step('if-elif-else block and do-while-finally block keywords', () => { const { parserOutput } = performParsingTestCase({ diff --git a/apps/parser/test/utils/mod.ts b/apps/parser/test/utils/mod.ts index 99e9609..82def56 100644 --- a/apps/parser/test/utils/mod.ts +++ b/apps/parser/test/utils/mod.ts @@ -2,7 +2,7 @@ import { type BasePrinter, EncodeLexer, type EncodeParser, - type CalvinTypeAnalyzer, + type TypeAnalyzer, debug, Globals, type PrecedenceHandler, @@ -34,7 +34,7 @@ export interface TestCaseParameters { * * **Note:** We choose not to instantiate this ourselves in case we want to inject something else, e.g. a shim or an experimental impl */ - typeAnalyzer: CalvinTypeAnalyzer; + typeAnalyzer: TypeAnalyzer; /** * The Encode code to parse */ From abfb60928fbfa0b00fc32282ed06f7f6f940ca90 Mon Sep 17 00:00:00 2001 From: Aidan Jones Date: Wed, 12 Nov 2025 13:42:59 -0600 Subject: [PATCH 5/6] chore(printers): rename paren printer --- apps/parser/main.ts | 4 ++-- apps/parser/src/visitors/printers/paren.ts | 2 +- apps/parser/test/end-to-end/parsing.test.ts | 2 +- apps/parser/test/integration/control-flow.test.ts | 2 +- apps/parser/test/integration/data-types.test.ts | 2 +- apps/parser/test/integration/expressions.test.ts | 2 +- apps/parser/test/integration/keywords.test.ts | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/parser/main.ts b/apps/parser/main.ts index a839e1a..edfc994 100644 --- a/apps/parser/main.ts +++ b/apps/parser/main.ts @@ -1,4 +1,4 @@ -import { EncodeLexer, EncodeParser, CalvinPrinter, Globals } from '@encode/parser/lib'; +import { EncodeLexer, EncodeParser, ParenPrinter, Globals } from '@encode/parser/lib'; import { parseArgs } from '@std/cli/parse-args'; import { join, toFileUrl } from '@std/path'; @@ -34,7 +34,7 @@ export async function main(): Promise { const parser = new EncodeParser(); - const printer = new CalvinPrinter(debugColors); + const printer = new ParenPrinter(debugColors); const lexingResult = EncodeLexer.tokenize(inputFile); // "input" is a setter which will reset the parser's state. diff --git a/apps/parser/src/visitors/printers/paren.ts b/apps/parser/src/visitors/printers/paren.ts index 52dd402..74883ea 100644 --- a/apps/parser/src/visitors/printers/paren.ts +++ b/apps/parser/src/visitors/printers/paren.ts @@ -18,7 +18,7 @@ import { BasePrinter } from './printer.ts'; const start = ANSIColor.BrightRed; const range = ANSIColor.BrightWhite - start; -export class CalvinPrinter extends BasePrinter implements ICstNodeVisitor { +export class ParenPrinter extends BasePrinter implements ICstNodeVisitor { constructor(colors: boolean = true, output: Logger | null = console.log) { super(colors, output); } diff --git a/apps/parser/test/end-to-end/parsing.test.ts b/apps/parser/test/end-to-end/parsing.test.ts index 314958d..f1074bb 100644 --- a/apps/parser/test/end-to-end/parsing.test.ts +++ b/apps/parser/test/end-to-end/parsing.test.ts @@ -25,7 +25,7 @@ Deno.test('Loading & parsing', async (t) => { const precedenceHandler = new TestSubject.PrecedenceHandler(); - const printer = new TestSubject.CalvinPrinter(); + const printer = new TestSubject.ParenPrinter(); const typeAnalyzer = new TestSubject.TypeAnalyzer(); diff --git a/apps/parser/test/integration/control-flow.test.ts b/apps/parser/test/integration/control-flow.test.ts index 7bec2a5..9247b13 100644 --- a/apps/parser/test/integration/control-flow.test.ts +++ b/apps/parser/test/integration/control-flow.test.ts @@ -9,7 +9,7 @@ Deno.test('Control flow parsing #integration', async (t) => { const precedenceHandler = new TestSubject.PrecedenceHandler(); - const printer = new TestSubject.CalvinPrinter(); + const printer = new TestSubject.ParenPrinter(); const typeAnalyzer = new TestSubject.TypeAnalyzer(); diff --git a/apps/parser/test/integration/data-types.test.ts b/apps/parser/test/integration/data-types.test.ts index 3ad67d6..5aba759 100644 --- a/apps/parser/test/integration/data-types.test.ts +++ b/apps/parser/test/integration/data-types.test.ts @@ -9,7 +9,7 @@ Deno.test('Data type parsing #integration', async (t) => { const precedenceHandler = new TestSubject.PrecedenceHandler(); - const printer = new TestSubject.CalvinPrinter(); + const printer = new TestSubject.ParenPrinter(); const typeAnalyzer = new TestSubject.TypeAnalyzer(); diff --git a/apps/parser/test/integration/expressions.test.ts b/apps/parser/test/integration/expressions.test.ts index cd2293b..4384c56 100644 --- a/apps/parser/test/integration/expressions.test.ts +++ b/apps/parser/test/integration/expressions.test.ts @@ -9,7 +9,7 @@ Deno.test('Expression parsing #integration', async (t) => { const precedenceHandler = new TestSubject.PrecedenceHandler(); - const printer = new TestSubject.CalvinPrinter(); + const printer = new TestSubject.ParenPrinter(); const typeAnalyzer = new TestSubject.TypeAnalyzer(); diff --git a/apps/parser/test/integration/keywords.test.ts b/apps/parser/test/integration/keywords.test.ts index ab9083b..911914b 100644 --- a/apps/parser/test/integration/keywords.test.ts +++ b/apps/parser/test/integration/keywords.test.ts @@ -9,7 +9,7 @@ Deno.test('Keyword parsing #integration', async (t) => { const precedenceHandler = new TestSubject.PrecedenceHandler(); - const printer = new TestSubject.CalvinPrinter(); + const printer = new TestSubject.ParenPrinter(); const typeAnalyzer = new TestSubject.TypeAnalyzer(); From aa231a082a0ab53ffb95ac5e266674798bc20376 Mon Sep 17 00:00:00 2001 From: Aidan Jones Date: Wed, 12 Nov 2025 13:51:05 -0600 Subject: [PATCH 6/6] chore: fix unsorted imports --- apps/parser/main.ts | 2 +- apps/parser/test/utils/mod.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/parser/main.ts b/apps/parser/main.ts index edfc994..89d4135 100644 --- a/apps/parser/main.ts +++ b/apps/parser/main.ts @@ -1,4 +1,4 @@ -import { EncodeLexer, EncodeParser, ParenPrinter, Globals } from '@encode/parser/lib'; +import { EncodeLexer, EncodeParser, Globals, ParenPrinter } from '@encode/parser/lib'; import { parseArgs } from '@std/cli/parse-args'; import { join, toFileUrl } from '@std/path'; diff --git a/apps/parser/test/utils/mod.ts b/apps/parser/test/utils/mod.ts index 82def56..1e6589e 100644 --- a/apps/parser/test/utils/mod.ts +++ b/apps/parser/test/utils/mod.ts @@ -1,11 +1,11 @@ import { type BasePrinter, + debug, EncodeLexer, type EncodeParser, - type TypeAnalyzer, - debug, Globals, type PrecedenceHandler, + type TypeAnalyzer, } from '@encode/parser/lib'; import type { ILexingResult } from 'chevrotain'; import type { FileCstChildren } from '@/generated/cst-types.ts';