Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"typescript": "^5.6.2"
},
"dependencies": {
"@matt.kantor/either": "^1.0.0",
"@matt.kantor/option": "^1.0.0",
"kleur": "^4.1.5"
}
}
9 changes: 0 additions & 9 deletions src/adts.ts

This file was deleted.

43 changes: 0 additions & 43 deletions src/adts/either-utilities.ts

This file was deleted.

37 changes: 0 additions & 37 deletions src/adts/either.ts

This file was deleted.

29 changes: 0 additions & 29 deletions src/adts/option-utilities.ts

This file was deleted.

33 changes: 0 additions & 33 deletions src/adts/option.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/end-to-end.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import either, { type Either } from '@matt.kantor/either'
import assert from 'node:assert'
import { either, type Either } from './adts.js'
import { compile } from './language/compiling.js'
import type { Atom, Molecule } from './language/parsing.js'
import { parse } from './language/parsing/parser.js'
Expand Down
2 changes: 1 addition & 1 deletion src/language/cli/input.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import either, { type Either } from '@matt.kantor/either'
import { parseArgs } from 'util'
import { either, type Either } from '../../adts.js'
import { type JsonValueForbiddingSymbolicKeys } from '../parsing.js'

export type InvalidJsonError = {
Expand Down
2 changes: 1 addition & 1 deletion src/language/cli/output.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import either, { type Either } from '@matt.kantor/either'
import { parseArgs } from 'util'
import { either, type Either } from '../../adts.js'
import { type SyntaxTree } from '../parsing/syntax-tree.js'
import { unparse, type Notation } from '../unparsing.js'
import { prettyJson } from '../unparsing/pretty-json.js'
Expand Down
2 changes: 1 addition & 1 deletion src/language/cli/please.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { either, type Either } from '../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import { compile } from '../compiling.js'
import type { Atom, Molecule } from '../parsing.js'
import { parse } from '../parsing/parser.js'
Expand Down
2 changes: 1 addition & 1 deletion src/language/compiling/compiler.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import either, { type Either } from '@matt.kantor/either'
import assert from 'node:assert'
import { either, type Either } from '../../adts.js'
import { withPhantomData } from '../../phantom-data.js'
import { testCases } from '../../test-utilities.test.js'
import type { ElaborationError } from '../errors.js'
Expand Down
2 changes: 1 addition & 1 deletion src/language/compiling/compiler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { either, type Either } from '../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import type { CompilationError } from '../errors.js'
import type { JsonValueForbiddingSymbolicKeys } from '../parsing.js'
import { canonicalize } from '../parsing.js'
Expand Down
3 changes: 2 additions & 1 deletion src/language/compiling/semantics.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import either, { type Either } from '@matt.kantor/either'
import option from '@matt.kantor/option'
import assert from 'node:assert'
import { either, option, type Either } from '../../adts.js'
import { withPhantomData } from '../../phantom-data.js'
import { testCases } from '../../test-utilities.test.js'
import type { Writable } from '../../utility-types.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { either, type Either } from '../../../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import type { ElaborationError } from '../../../errors.js'
import {
asSemanticGraph,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { either, option, type Either } from '../../../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import option from '@matt.kantor/option'
import type { ElaborationError } from '../../../errors.js'
import {
asSemanticGraph,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { either, option, type Either } from '../../../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import option from '@matt.kantor/option'
import type { ElaborationError } from '../../../errors.js'
import {
asSemanticGraph,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { either, option, type Either, type Option } from '../../../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import option, { type Option } from '@matt.kantor/option'
import type {
ElaborationError,
InvalidExpressionError,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { either, type Either } from '../../../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import type { ElaborationError } from '../../../errors.js'
import {
asSemanticGraph,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { either, type Either } from '../../../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import type { ElaborationError } from '../../../errors.js'
import {
makeObjectNode,
Expand Down
2 changes: 1 addition & 1 deletion src/language/parsing/parser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { either, type Either } from '../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import type { ParseError } from '../errors.js'
import { type SyntaxTree, syntaxTreeParser } from './syntax-tree.js'

Expand Down
2 changes: 1 addition & 1 deletion src/language/parsing/syntax-tree.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { option, type Option } from '../../adts.js'
import option, { type Option } from '@matt.kantor/option'
import { parser, type Parser } from '../../parsing.js'
import { withPhantomData, type WithPhantomData } from '../../phantom-data.js'
import type {
Expand Down
2 changes: 1 addition & 1 deletion src/language/runtime/evaluator.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import either, { type Either } from '@matt.kantor/either'
import assert from 'node:assert'
import { either, type Either } from '../../adts.js'
import { withPhantomData } from '../../phantom-data.js'
import { testCases } from '../../test-utilities.test.js'
import type { ElaborationError } from '../errors.js'
Expand Down
2 changes: 1 addition & 1 deletion src/language/runtime/evaluator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { either, type Either } from '../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import type { RuntimeError } from '../errors.js'
import type { JsonValueForbiddingSymbolicKeys } from '../parsing.js'
import { canonicalize } from '../parsing.js'
Expand Down
3 changes: 2 additions & 1 deletion src/language/runtime/keywords.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import either from '@matt.kantor/either'
import option, { type Option } from '@matt.kantor/option'
import { parseArgs } from 'util'
import { either, option, type Option } from '../../adts.js'
import { writeOutput } from '../cli/output.js'
import { keywordHandlers as compilerKeywordHandlers } from '../compiling.js'
import type { Atom } from '../parsing.js'
Expand Down
32 changes: 15 additions & 17 deletions src/language/semantics/expression-elaboration.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { either, option, type Either } from '../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import option from '@matt.kantor/option'
import { withPhantomData, type WithPhantomData } from '../../phantom-data.js'
import type { Writable } from '../../utility-types.js'
import type { ElaborationError, InvalidSyntaxTreeError } from '../errors.js'
Expand Down Expand Up @@ -158,23 +159,20 @@ const handleObjectNodeWhichMayBeAExpression = (
context: ExpressionContext,
): Either<ElaborationError, SemanticGraph> => {
const { 0: possibleKeyword, ...possibleArguments } = node
return option.match(option.fromPredicate(possibleKeyword, isKeyword), {
none: () =>
/^@[^@]/.test(possibleKeyword)
? either.makeLeft({
kind: 'unknownKeyword',
message: `unknown keyword: \`${possibleKeyword}\``,
})
: either.makeRight({
...node,
0: unescapeKeywordSigil(possibleKeyword),
}),
some: keyword =>
context.keywordHandlers[keyword](
makeObjectNode({ ...possibleArguments, 0: keyword }),
return isKeyword(possibleKeyword)
? context.keywordHandlers[possibleKeyword](
makeObjectNode({ ...possibleArguments, 0: possibleKeyword }),
context,
),
})
)
: /^@[^@]/.test(possibleKeyword)
? either.makeLeft({
kind: 'unknownKeyword',
message: `unknown keyword: \`${possibleKeyword}\``,
})
: either.makeRight({
...node,
0: unescapeKeywordSigil(possibleKeyword),
})
}

const handleAtomWhichMayNotBeAKeyword = (
Expand Down
2 changes: 1 addition & 1 deletion src/language/semantics/expressions/apply-expression.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { either, type Either } from '../../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import type { ElaborationError } from '../../errors.js'
import type { Molecule } from '../../parsing.js'
import { isExpression } from '../expression.js'
Expand Down
2 changes: 1 addition & 1 deletion src/language/semantics/expressions/check-expression.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { either, type Either } from '../../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import type { ElaborationError } from '../../errors.js'
import type { Molecule } from '../../parsing.js'
import { isExpression } from '../expression.js'
Expand Down
3 changes: 2 additions & 1 deletion src/language/semantics/expressions/expression-utilities.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { either, option, type Either, type Option } from '../../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import option, { type Option } from '@matt.kantor/option'
import type { ElaborationError } from '../../errors.js'
import type { Atom, Molecule } from '../../parsing.js'
import type { ExpressionContext } from '../expression-elaboration.js'
Expand Down
2 changes: 1 addition & 1 deletion src/language/semantics/expressions/function-expression.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { either, type Either } from '../../../adts.js'
import either, { type Either } from '@matt.kantor/either'
import type { ElaborationError } from '../../errors.js'
import type { Atom, Molecule } from '../../parsing.js'
import { isExpression } from '../expression.js'
Expand Down
Loading
Loading