Compare commits

...

7 Commits

17 changed files with 624 additions and 96 deletions

View File

@ -7,6 +7,9 @@ import * as readline from 'readline'
import { readFileSync, writeFileSync } from 'fs'
import { basename } from 'path'
globals.$.script.name = '(repl)'
globals.$.script.path = '(repl)'
async function repl() {
const commands = ['/clear', '/reset', '/vars', '/funcs', '/history', '/bytecode', '/exit', '/save', '/quit']

View File

@ -1,8 +1,9 @@
#!/usr/bin/env bun
import { colors } from '../src/prelude'
import { colors, globals as prelude } from '../src/prelude'
import { treeToString } from '../src/utils/tree'
import { runCode, runFile, compileFile, parseCode } from '../src'
import { resolve } from 'path'
import { bytecodeToString } from 'reefvm'
import { readFileSync } from 'fs'
import { spawn } from 'child_process'
@ -34,6 +35,9 @@ function showVersion() {
}
async function evalCode(code: string, imports: string[]) {
const idx = Bun.argv.indexOf('--')
prelude.$.args = idx >= 0 ? Bun.argv.slice(idx + 1) : []
const importStatement = imports.length > 0 ? `import ${imports.join(' ')}` : ''
if (importStatement) code = `${importStatement}; ${code}`
return await runCode(code)
@ -149,10 +153,12 @@ async function main() {
console.log(`${colors.bright}usage: shrimp run <file>${colors.reset}`)
process.exit(1)
}
prelude.$.script.path = resolve(file)
await runFile(file)
return
}
prelude.$.script.path = resolve(command)
await runFile(command)
}

View File

@ -211,16 +211,37 @@ export class Compiler {
}
case terms.DotGet: {
// DotGet is parsed into a nested tree because it's hard to parse it into a flat one.
// However, we want a flat tree - so we're going to pretend like we are getting one from the parser.
//
// This: DotGet(config, DotGet(script, name))
// Becomes: DotGet(config, script, name)
const { objectName, property } = getDotGetParts(node, input)
const instructions: ProgramItem[] = []
instructions.push(['TRY_LOAD', objectName])
if (property.type.id === terms.ParenExpr) {
instructions.push(...this.#compileNode(property, input))
} else {
const propertyValue = input.slice(property.from, property.to)
instructions.push(['PUSH', propertyValue])
const flattenProperty = (prop: SyntaxNode): void => {
if (prop.type.id === terms.DotGet) {
const nestedParts = getDotGetParts(prop, input)
const nestedObjectValue = input.slice(nestedParts.object.from, nestedParts.object.to)
instructions.push(['PUSH', nestedObjectValue])
instructions.push(['DOT_GET'])
flattenProperty(nestedParts.property)
} else {
if (prop.type.id === terms.ParenExpr) {
instructions.push(...this.#compileNode(prop, input))
} else {
const propertyValue = input.slice(prop.from, prop.to)
instructions.push(['PUSH', propertyValue])
}
instructions.push(['DOT_GET'])
}
}
instructions.push(['DOT_GET'])
flattenProperty(property)
return instructions
}
@ -313,15 +334,17 @@ export class Compiler {
if (opValue === '??=') {
instructions.push(['LOAD', identifierName])
const skipLabel: Label = `.skip_${this.labelCount++}`
const rightInstructions = this.#compileNode(right, input)
instructions.push(['DUP'])
instructions.push(['PUSH', null])
instructions.push(['NEQ'])
instructions.push(['JUMP_IF_TRUE', rightInstructions.length + 1])
instructions.push(['JUMP_IF_TRUE', skipLabel])
instructions.push(['POP'])
instructions.push(...rightInstructions)
instructions.push([`${skipLabel}:`])
instructions.push(['DUP'])
instructions.push(['STORE', identifierName])
@ -419,8 +442,8 @@ export class Compiler {
case terms.FunctionCallOrIdentifier: {
if (node.firstChild?.type.id === terms.DotGet) {
const instructions: ProgramItem[] = []
const callLabel = `.call_dotget_${++this.labelCount}`
const afterLabel = `.after_dotget_${++this.labelCount}`
const callLabel: Label = `.call_dotget_${++this.labelCount}`
const afterLabel: Label = `.after_dotget_${++this.labelCount}`
instructions.push(...this.#compileNode(node.firstChild, input))
instructions.push(['DUP'])
@ -459,6 +482,7 @@ export class Compiler {
PUSH 1 ; Named count
CALL
*/
case terms.FunctionCallWithNewlines:
case terms.FunctionCall: {
const { identifierNode, namedArgs, positionalArgs } = getFunctionCallParts(node, input)
const instructions: ProgramItem[] = []
@ -582,19 +606,24 @@ export class Compiler {
instructions.push(...this.#compileNode(conditionNode, input))
this.ifLabelCount++
const endLabel: Label = `.end_${this.ifLabelCount}`
const elseLabel: Label = `.else_${this.ifLabelCount}`
const thenBlockInstructions = this.#compileNode(thenBlock, input)
instructions.push(['JUMP_IF_FALSE', thenBlockInstructions.length + 1])
instructions.push(['JUMP_IF_FALSE', elseLabel])
instructions.push(...thenBlockInstructions)
instructions.push(['JUMP', endLabel])
instructions.push([`${elseLabel}:`])
// Else if
elseIfBlocks.forEach(({ conditional, thenBlock }) => {
elseIfBlocks.forEach(({ conditional, thenBlock }, index) => {
instructions.push(...this.#compileNode(conditional, input))
const nextLabel: Label = `.elsif_${this.ifLabelCount}_${index}`
const elseIfInstructions = this.#compileNode(thenBlock, input)
instructions.push(['JUMP_IF_FALSE', elseIfInstructions.length + 1])
instructions.push(['JUMP_IF_FALSE', nextLabel])
instructions.push(...elseIfInstructions)
instructions.push(['JUMP', endLabel])
instructions.push([`${nextLabel}:`])
})
// Else
@ -643,34 +672,41 @@ export class Compiler {
instructions.push(...leftInstructions, ...rightInstructions, ['GTE'])
break
case 'and':
case 'and': {
const skipLabel: Label = `.skip_${this.labelCount++}`
instructions.push(...leftInstructions)
instructions.push(['DUP'])
instructions.push(['JUMP_IF_FALSE', rightInstructions.length + 1])
instructions.push(['JUMP_IF_FALSE', skipLabel])
instructions.push(['POP'])
instructions.push(...rightInstructions)
instructions.push([`${skipLabel}:`])
break
}
case 'or':
case 'or': {
const skipLabel: Label = `.skip_${this.labelCount++}`
instructions.push(...leftInstructions)
instructions.push(['DUP'])
instructions.push(['JUMP_IF_TRUE', rightInstructions.length + 1])
instructions.push(['JUMP_IF_TRUE', skipLabel])
instructions.push(['POP'])
instructions.push(...rightInstructions)
instructions.push([`${skipLabel}:`])
break
}
case '??':
case '??': {
// Nullish coalescing: return left if not null, else right
const skipLabel: Label = `.skip_${this.labelCount++}`
instructions.push(...leftInstructions)
instructions.push(['DUP'])
instructions.push(['PUSH', null])
instructions.push(['NEQ'])
instructions.push(['JUMP_IF_TRUE', rightInstructions.length + 1])
instructions.push(['JUMP_IF_TRUE', skipLabel])
instructions.push(['POP'])
instructions.push(...rightInstructions)
instructions.push([`${skipLabel}:`])
break
}
default:
throw new CompilerError(`Unsupported conditional operator: ${opValue}`, op.from, op.to)
@ -828,7 +864,7 @@ export class Compiler {
default:
throw new CompilerError(
`Compiler doesn't know how to handle a "${node.type.name}" node.`,
`Compiler doesn't know how to handle a "${node.type.name}" (${node.type.id}) node.`,
node.from,
node.to
)

View File

@ -188,6 +188,16 @@ describe('compiler', () => {
test('single line if', () => {
expect(`if 3 < 9: shire end`).toEvaluateTo('shire')
})
test('if statement with function definition (bytecode labels)', () => {
expect(`
if false:
abc = do x: x end
else:
nope
end
`).toEvaluateTo('nope')
})
})
describe('errors', () => {
@ -284,6 +294,43 @@ describe('dot get', () => {
test('use parens expr with dot-get', () => {
expect(`a = 1; arr = array 'a' 'b' 'c'; arr.(1 + a)`).toEvaluateTo('c', { array })
})
test('chained dot get: two levels', () => {
expect(`obj = [inner=[value=42]]; obj.inner.value`).toEvaluateTo(42)
})
test('chained dot get: three levels', () => {
expect(`obj = [a=[b=[c=123]]]; obj.a.b.c`).toEvaluateTo(123)
})
test('chained dot get: four levels', () => {
expect(`obj = [w=[x=[y=[z='deep']]]]; obj.w.x.y.z`).toEvaluateTo('deep')
})
test('chained dot get with numeric index', () => {
expect(`obj = [items=[1 2 3]]; obj.items.0`).toEvaluateTo(1)
})
test('chained dot get in expression', () => {
expect(`config = [server=[port=3000]]; config.server.port + 1`).toEvaluateTo(3001)
})
test('chained dot get as function argument', () => {
const double = (x: number) => x * 2
expect(`obj = [val=[num=21]]; double obj.val.num`).toEvaluateTo(42, { double })
})
test('chained dot get in binary operation', () => {
expect(`a = [x=[y=10]]; b = [x=[y=20]]; a.x.y + b.x.y`).toEvaluateTo(30)
})
test('chained dot get with parens at end', () => {
expect(`idx = 1; obj = [items=[10 20 30]]; obj.items.(idx)`).toEvaluateTo(20)
})
test('mixed chained and simple dot get', () => {
expect(`obj = [a=1 b=[c=2]]; obj.a + obj.b.c`).toEvaluateTo(3)
})
})
describe('default params', () => {

View File

@ -93,7 +93,6 @@ describe('pipe expressions', () => {
`).toEvaluateTo(5)
})
test('string literals can be piped', () => {
expect(`'hey there' | str.to-upper`).toEvaluateTo('HEY THERE')
})

View File

@ -293,7 +293,7 @@ export const getDotGetParts = (node: SyntaxNode, input: string) => {
)
}
if (object.type.id !== terms.IdentifierBeforeDot) {
if (object.type.id !== terms.IdentifierBeforeDot && object.type.id !== terms.Dollar) {
throw new CompilerError(
`DotGet object must be an IdentifierBeforeDot, got ${object.type.name}`,
object.from,
@ -301,9 +301,9 @@ export const getDotGetParts = (node: SyntaxNode, input: string) => {
)
}
if (![terms.Identifier, terms.Number, terms.ParenExpr].includes(property.type.id)) {
if (![terms.Identifier, terms.Number, terms.ParenExpr, terms.DotGet].includes(property.type.id)) {
throw new CompilerError(
`DotGet property must be an Identifier or Number, got ${property.type.name}`,
`DotGet property must be an Identifier, Number, ParenExpr, or DotGet, got ${property.type.name}`,
property.from,
property.to
)
@ -311,7 +311,7 @@ export const getDotGetParts = (node: SyntaxNode, input: string) => {
const objectName = input.slice(object.from, object.to)
return { objectName, property }
return { object, objectName, property }
}
export const getTryExprParts = (node: SyntaxNode, input: string) => {

View File

@ -4,7 +4,7 @@ import { type Tree } from '@lezer/common'
import { Compiler } from '#compiler/compiler'
import { parser } from '#parser/shrimp'
import { globals as parserGlobals, setGlobals as setParserGlobals } from '#parser/tokenizer'
import { globals as shrimpGlobals } from '#prelude'
import { globals as prelude } from '#prelude'
export { Compiler } from '#compiler/compiler'
export { parser } from '#parser/shrimp'
@ -19,7 +19,7 @@ export class Shrimp {
constructor(globals?: Record<string, any>) {
const emptyBytecode = { instructions: [], constants: [], labels: new Map() }
this.vm = new VM(emptyBytecode, Object.assign({}, shrimpGlobals, globals ?? {}))
this.vm = new VM(emptyBytecode, Object.assign({}, prelude, globals ?? {}))
this.globals = globals
}
@ -53,7 +53,7 @@ export class Shrimp {
let bytecode
if (typeof code === 'string') {
const compiler = new Compiler(code, Object.keys(Object.assign({}, shrimpGlobals, this.globals ?? {}, locals ?? {})))
const compiler = new Compiler(code, Object.keys(Object.assign({}, prelude, this.globals ?? {}, locals ?? {})))
bytecode = compiler.bytecode
} else {
bytecode = code
@ -79,7 +79,7 @@ export async function runCode(code: string, globals?: Record<string, any>): Prom
}
export async function runBytecode(bytecode: Bytecode, globals?: Record<string, any>): Promise<any> {
const vm = new VM(bytecode, Object.assign({}, shrimpGlobals, globals))
const vm = new VM(bytecode, Object.assign({}, prelude, globals))
await vm.run()
return vm.stack.length ? fromValue(vm.stack[vm.stack.length - 1]!, vm) : null
}
@ -90,7 +90,7 @@ export function compileFile(path: string, globals?: Record<string, any>): Byteco
}
export function compileCode(code: string, globals?: Record<string, any>): Bytecode {
const globalNames = [...Object.keys(shrimpGlobals), ...(globals ? Object.keys(globals) : [])]
const globalNames = [...Object.keys(prelude), ...(globals ? Object.keys(globals) : [])]
const compiler = new Compiler(code, globalNames)
return compiler.bytecode
}
@ -102,7 +102,7 @@ export function parseFile(path: string, globals?: Record<string, any>): Tree {
export function parseCode(code: string, globals?: Record<string, any>): Tree {
const oldGlobals = [...parserGlobals]
const globalNames = [...Object.keys(shrimpGlobals), ...(globals ? Object.keys(globals) : [])]
const globalNames = [...Object.keys(prelude), ...(globals ? Object.keys(globals) : [])]
setParserGlobals(globalNames)
const result = parser.parse(code)

View File

@ -21,7 +21,7 @@
("-" | "+")? $[0-9]+ ("_"? $[0-9]+)* ('.' $[0-9]+ ("_"? $[0-9]+)*)?
}
Boolean { "true" | "false" }
newlineOrSemicolon { "\n" | ";" }
semicolon { ";" }
eof { @eof }
space { " " | "\t" }
Comment { "#" ![\n]* }
@ -29,10 +29,13 @@
rightParen { ")" }
colon[closedBy="end", @name="colon"] { ":" }
Underscore { "_" }
Dollar { "$" }
Regex { "//" (![/\\\n[] | "\\" ![\n] | "[" (![\n\\\]] | "\\" ![\n])* "]")+ ("//" $[gimsuy]*)? } // Stolen from the lezer JavaScript grammar
"|"[@name=operator]
}
newlineOrSemicolon { newline | semicolon }
end { @specialize[@name=keyword]<Identifier, "end"> }
while { @specialize[@name=keyword]<Identifier, "while"> }
if { @specialize[@name=keyword]<Identifier, "if"> }
@ -45,6 +48,7 @@ import { @specialize[@name=keyword]<Identifier, "import"> }
null { @specialize[@name=Null]<Identifier, "null"> }
@external tokens tokenizer from "./tokenizer" { Identifier, AssignableIdentifier, Word, IdentifierBeforeDot, CurlyString }
@external tokens pipeStartsLineTokenizer from "./tokenizer" { newline, pipeStartsLine }
@external specialize {Identifier} specializeKeyword from "./tokenizer" { Do }
@precedence {
@ -84,7 +88,7 @@ consumeToTerminator {
}
PipeExpr {
pipeOperand (!pipe "|" pipeOperand)+
pipeOperand (!pipe (pipeStartsLine? "|") newlineOrSemicolon* pipeOperand)+
}
pipeOperand {
@ -239,7 +243,8 @@ expression {
@skip {} {
DotGet {
IdentifierBeforeDot dot (Number | Identifier | ParenExpr)
IdentifierBeforeDot dot (DotGet | Number | Identifier | ParenExpr) |
Dollar dot (DotGet | Number | Identifier | ParenExpr)
}
String {
@ -254,7 +259,7 @@ stringContent {
}
Interpolation {
"$" Identifier |
"$" FunctionCallOrIdentifier |
"$" ParenExpr
}

View File

@ -32,47 +32,50 @@ export const
Word = 30,
IdentifierBeforeDot = 31,
CurlyString = 32,
newline = 101,
pipeStartsLine = 102,
Do = 33,
Comment = 34,
Program = 35,
PipeExpr = 36,
WhileExpr = 38,
keyword = 83,
keyword = 84,
ConditionalOp = 40,
ParenExpr = 41,
FunctionCallWithNewlines = 42,
DotGet = 43,
Number = 44,
PositionalArg = 45,
FunctionDef = 46,
Params = 47,
NamedParam = 48,
NamedArgPrefix = 49,
String = 50,
StringFragment = 51,
Interpolation = 52,
EscapeSeq = 53,
DoubleQuote = 54,
Boolean = 55,
Null = 56,
colon = 57,
CatchExpr = 58,
Block = 60,
FinallyExpr = 61,
Underscore = 64,
NamedArg = 65,
IfExpr = 66,
FunctionCall = 68,
ElseIfExpr = 69,
ElseExpr = 71,
FunctionCallOrIdentifier = 72,
BinOp = 73,
Regex = 74,
Dict = 75,
Array = 76,
FunctionCallWithBlock = 77,
TryExpr = 78,
Throw = 80,
Import = 82,
CompoundAssign = 84,
Assign = 85
Dollar = 45,
PositionalArg = 46,
FunctionDef = 47,
Params = 48,
NamedParam = 49,
NamedArgPrefix = 50,
String = 51,
StringFragment = 52,
Interpolation = 53,
FunctionCallOrIdentifier = 54,
EscapeSeq = 55,
DoubleQuote = 56,
Boolean = 57,
Null = 58,
colon = 59,
CatchExpr = 60,
Block = 62,
FinallyExpr = 63,
Underscore = 66,
NamedArg = 67,
IfExpr = 68,
FunctionCall = 70,
ElseIfExpr = 71,
ElseExpr = 73,
BinOp = 74,
Regex = 75,
Dict = 76,
Array = 77,
FunctionCallWithBlock = 78,
TryExpr = 79,
Throw = 81,
Import = 83,
CompoundAssign = 85,
Assign = 86

View File

@ -1,27 +1,27 @@
// This file was generated by lezer-generator. You probably shouldn't edit it.
import {LRParser, LocalTokenGroup} from "@lezer/lr"
import {operatorTokenizer} from "./operatorTokenizer"
import {tokenizer, specializeKeyword} from "./tokenizer"
import {tokenizer, pipeStartsLineTokenizer, specializeKeyword} from "./tokenizer"
import {trackScope} from "./parserScopeContext"
import {highlighting} from "./highlight"
const spec_Identifier = {__proto__:null,while:78, null:112, catch:118, finally:124, end:126, if:134, else:140, try:158, throw:162, import:166}
const spec_Identifier = {__proto__:null,while:78, null:116, catch:122, finally:128, end:130, if:138, else:144, try:160, throw:164, import:168}
export const parser = LRParser.deserialize({
version: 14,
states: "=|QYQbOOO!mOpO'#DXO!rOSO'#D`OOQa'#D`'#D`O%mQcO'#DvO(mQcO'#EiOOQ`'#Ew'#EwO)WQRO'#DwO+]QcO'#EgO+vQbO'#DVOOQa'#Dy'#DyO.[QbO'#DzOOQa'#Ei'#EiO.cQcO'#EiO0aQcO'#EhO1fQcO'#EgO1sQRO'#ESOOQ`'#Eg'#EgO2[QbO'#EgO2cQQO'#EfOOQ`'#Ef'#EfOOQ`'#EU'#EUQYQbOOO2nQbO'#D[O2yQbO'#DpO3tQbO'#DSO4oQQO'#D|O3tQbO'#EOO4tQbO'#EQO4|ObO,59sO5XQbO'#DbO5aQWO'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!V!_!b!p#j#o#t$^$t%]%h%kQ![XR#h!T[wSTx!U!V!pQ$Z#jV%[$t%]%kTqQrQ$e#xR%R$lQ!thR%q%hrbOf!c!d!e!h!w#x$Q$R$S$d$l${%_%i%tQ!ZXR#g!T",
nodeNames: "⚠ Star Slash Plus Minus And Or Eq EqEq Neq Lt Lte Gt Gte Modulo PlusEq MinusEq StarEq SlashEq ModuloEq Band Bor Bxor Shl Shr Ushr NullishCoalesce NullishEq Identifier AssignableIdentifier Word IdentifierBeforeDot CurlyString Do Comment Program PipeExpr operator WhileExpr keyword ConditionalOp ParenExpr FunctionCall DotGet Number PositionalArg FunctionDef Params NamedParam NamedArgPrefix String StringFragment Interpolation EscapeSeq DoubleQuote Boolean Null colon CatchExpr keyword Block FinallyExpr keyword keyword Underscore NamedArg IfExpr keyword FunctionCall ElseIfExpr keyword ElseExpr FunctionCallOrIdentifier BinOp Regex Dict Array FunctionCallWithBlock TryExpr keyword Throw keyword Import keyword CompoundAssign Assign",
maxTerm: 124,
states: "?[QYQ!SOOOOQ!Q'#Ek'#EkO!sO!bO'#DXO%kQ!TO'#DdO&UOSO'#DaOOQ!R'#Da'#DaO)SQ!TO'#EnOOQ!Q'#E{'#E{O)pQRO'#DxO+xQ!TO'#EjO,fQ!SO'#DVOOQ!R'#Dz'#DzO/WQ!SO'#D{OOQ!R'#En'#EnO/_Q!TO'#EnO1cQ!TO'#EmO2qQ!TO'#EjO3OQRO'#ETOOQ!Q'#Ej'#EjO3gQ!SO'#EjO3nQrO'#EiOOQ!Q'#Ei'#EiOOQ!Q'#EV'#EVQYQ!SOOO4PQbO'#D]O4[QbO'#DrO5YQbO'#DSO6WQQO'#D}O5YQbO'#EPO6]QbO'#ERO6eObO,59sOOQ!Q'#D['#D[O6vQbO'#DqOOQ!Q'#Eq'#EqOOQ!Q'#E_'#E_O7QQ!SO,5:`OOQ!R'#Em'#EmO8QQbO'#DcO8`QWO'#DeOOOO'#Es'#EsOOOO'#E['#E[O8tOSO,59{OO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z$h$rR#}!gQ!UYQ!`[d#f!U!`#m#n$O$^$q${%e%sS#m!V!WS#n!X!^Q$O!iS$^#g#lQ$q$QQ${$`R%e$|Q!mhQ!}mU$R!m!}$[R$[#PQ!phQ$S!mT$U!p$SQySR#WyS$i#{$sR%Q$iQ$|$`R%f$|YsRU!V!W!rR#SsQ%]$tR%m%]Q#t!aQ$a#pT$e#t$aQ#w!cQ$c#rT$f#w$cQ#PmQ$Z!}U$]#P$Z$yR$y$[TfOgSdOgS!_Y!UQ#x!dQ#y!e`#z!f!y$W$X%S%g%q%|Q$P!iU$h#{$i$sS$p$O$QQ$r$VR%V$qSeOg|!TY[!U!V!W!X!^!`!i#g#l#m#n$O$Q$^$`$q${$|%e%sQ!hdW#s!a#p#t$aW#v!c#r#w$c`#{!f!y$W$X%S%g%q%|U$g#{$i$sQ$s$VR%P$h|WOYg!U!d!e!f!i!y#{$O$Q$V$W$X$i$q$s%S%g%q%|doRUs!V!W!r#m${%e%sQ!c[S!ti%pQ!wjQ!zlQ#RpQ#Y{Q#Z|Q#[}Q#^!OQ#`!PQ#a!QQ#c!RQ#d!SQ#r!`X#v!c#r#w$cx_Og!d!e!f!i!y#{$O$Q$V$W$X$i$q$s%S%g%q%|![tRU[ijlps{|}!O!P!Q!R!S!V!W!`!c!r#m#r#w$c${%e%p%sQ!]YR#k!U[rRUs!V!W!rQ$`#mV%d${%e%sTxSyQ$j#{R%Z$sQ!viR%y%pxcOg!d!e!f!i!y#{$O$Q$V$W$X$i$q$s%S%g%q%|Q![YR#j!U",
nodeNames: "⚠ Star Slash Plus Minus And Or Eq EqEq Neq Lt Lte Gt Gte Modulo PlusEq MinusEq StarEq SlashEq ModuloEq Band Bor Bxor Shl Shr Ushr NullishCoalesce NullishEq Identifier AssignableIdentifier Word IdentifierBeforeDot CurlyString Do Comment Program PipeExpr operator WhileExpr keyword ConditionalOp ParenExpr FunctionCall DotGet Number Dollar PositionalArg FunctionDef Params NamedParam NamedArgPrefix String StringFragment Interpolation FunctionCallOrIdentifier EscapeSeq DoubleQuote Boolean Null colon CatchExpr keyword Block FinallyExpr keyword keyword Underscore NamedArg IfExpr keyword FunctionCall ElseIfExpr keyword ElseExpr BinOp Regex Dict Array FunctionCallWithBlock TryExpr keyword Throw keyword Import keyword CompoundAssign Assign",
maxTerm: 128,
context: trackScope,
nodeProps: [
["closedBy", 57,"end"]
["closedBy", 59,"end"]
],
propSources: [highlighting],
skippedNodes: [0,34],
repeatNodeCount: 13,
tokenData: "Lq~R!OOX$RXY$pYZ%ZZp$Rpq$pqr$Rrs%tst'ztu)cuw$Rwx)hxy)myz*Wz{$R{|*q|}$R}!O*q!O!P$R!P!Q4^!Q!R+c!R![.W![!]<y!]!^%Z!^!}$R!}#O=d#O#P?Y#P#Q?_#Q#R$R#R#S?x#S#T$R#T#Y@c#Y#ZA}#Z#b@c#b#cGk#c#f@c#f#gHn#g#h@c#h#iIq#i#o@c#o#p$R#p#qLR#q;'S$R;'S;=`$j<%l~$R~O$R~~LlS$WU!TSOt$Ruw$Rx#O$R#P;'S$R;'S;=`$j<%lO$RS$mP;=`<%l$R^$wU!TS#XYOt$Ruw$Rx#O$R#P;'S$R;'S;=`$j<%lO$RU%bU!TS#_QOt$Ruw$Rx#O$R#P;'S$R;'S;=`$j<%lO$RU%yZ!TSOr%trs&lst%ttu'Vuw%twx'Vx#O%t#O#P'V#P;'S%t;'S;=`'t<%lO%tU&sU!WQ!TSOt$Ruw$Rx#O$R#P;'S$R;'S;=`$j<%lO$RQ'YTOr'Vrs'is;'S'V;'S;=`'n<%lO'VQ'nO!WQQ'qP;=`<%l'VU'wP;=`<%l%t^(RZrY!TSOY'zYZ$RZt'ztu(tuw'zwx(tx#O'z#O#P(t#P;'S'z;'S;=`)]<%lO'zY(ySrYOY(tZ;'S(t;'S;=`)V<%lO(tY)YP;=`<%l(t^)`P;=`<%l'z~)hO#d~~)mO#b~U)tU!TS#^QOt$Ruw$Rx#O$R#P;'S$R;'S;=`$j<%lO$RU*_U!TS#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$Ouw$Ox}$O}!O@b!O!Q$O!Q![@b![!_$O!_!`Ac!`#O$O#P#T$O#T#g@b#g#hE`#h#o@b#o;'S$O;'S;=`$g<%lO$OUEe`!USOt$Ouw$Ox}$O}!O@b!O!Q$O!Q![@b![!_$O!_!`Ac!`#O$O#P#T$O#T#X@b#X#YFg#Y#o@b#o;'S$O;'S;=`$g<%lO$OUFn^!ZQ!USOt$Ouw$Ox}$O}!O@b!O!Q$O!Q![@b![!_$O!_!`Ac!`#O$O#P#T$O#T#o@b#o;'S$O;'S;=`$g<%lO$O^Gq^#jW!USOt$Ouw$Ox}$O}!O@b!O!Q$O!Q![@b![!_$O!_!`Ac!`#O$O#P#T$O#T#o@b#o;'S$O;'S;=`$g<%lO$O^Ht^#lW!USOt$Ouw$Ox}$O}!O@b!O!Q$O!Q![@b![!_$O!_!`Ac!`#O$O#P#T$O#T#o@b#o;'S$O;'S;=`$g<%lO$O^Iw`#kW!USOt$Ouw$Ox}$O}!O@b!O!Q$O!Q![@b![!_$O!_!`Ac!`#O$O#P#T$O#T#f@b#f#gJy#g#o@b#o;'S$O;'S;=`$g<%lO$OUKO`!USOt$Ouw$Ox}$O}!O@b!O!Q$O!Q![@b![!_$O!_!`Ac!`#O$O#P#T$O#T#i@b#i#jE`#j#o@b#o;'S$O;'S;=`$g<%lO$OULXUuQ!USOt$Ouw$Ox#O$O#P;'S$O;'S;=`$g<%lO$O~LpO#t~",
tokenizers: [operatorTokenizer, 1, 2, 3, tokenizer, pipeStartsLineTokenizer, new LocalTokenGroup("[~RP!O!PU~ZO#d~~", 11)],
topRules: {"Program":[0,35]},
specialized: [{term: 28, get: (value: any, stack: any) => (specializeKeyword(value, stack) << 1), external: specializeKeyword},{term: 28, get: (value: keyof typeof spec_Identifier) => spec_Identifier[value] || -1}],
tokenPrec: 2370
tokenPrec: 2589
})

View File

@ -440,6 +440,26 @@ describe('Parentheses', () => {
PositionalArg
Identifier arg3`)
})
test('function call with mulitline identifiers starting separate lines in parens', () => {
expect(`(
echo
arg1
arg2
arg3
)`).toMatchTree(`
ParenExpr
FunctionCall
Identifier echo
PositionalArg
Identifier arg1
PositionalArg
Identifier arg2
PositionalArg
Identifier arg3`)
})
})
describe('Number literals', () => {

View File

@ -298,4 +298,163 @@ end`).toMatchTree(`
Number 2
`)
})
// NOTE: these are parsed as DotGet(meta, DotGet(script, name)) because that's easiest,
// but the compiler flattens them
test('chained dot get: meta.script.name', () => {
expect('meta = 42; meta.script.name').toMatchTree(`
Assign
AssignableIdentifier meta
Eq =
Number 42
FunctionCallOrIdentifier
DotGet
IdentifierBeforeDot meta
DotGet
IdentifierBeforeDot script
Identifier name
`)
})
test('chained dot get: a.b.c.d', () => {
expect('a = 1; a.b.c.d').toMatchTree(`
Assign
AssignableIdentifier a
Eq =
Number 1
FunctionCallOrIdentifier
DotGet
IdentifierBeforeDot a
DotGet
IdentifierBeforeDot b
DotGet
IdentifierBeforeDot c
Identifier d
`)
})
test('chained dot get in function call', () => {
expect('config = 1; echo config.db.host').toMatchTree(`
Assign
AssignableIdentifier config
Eq =
Number 1
FunctionCall
Identifier echo
PositionalArg
DotGet
IdentifierBeforeDot config
DotGet
IdentifierBeforeDot db
Identifier host
`)
})
test('chained dot get with numeric index at end', () => {
expect('obj = 1; obj.items.0').toMatchTree(`
Assign
AssignableIdentifier obj
Eq =
Number 1
FunctionCallOrIdentifier
DotGet
IdentifierBeforeDot obj
DotGet
IdentifierBeforeDot items
Number 0
`)
})
test('chained dot get with ParenExpr at end', () => {
expect('obj = 1; obj.items.(i)').toMatchTree(`
Assign
AssignableIdentifier obj
Eq =
Number 1
FunctionCallOrIdentifier
DotGet
IdentifierBeforeDot obj
DotGet
IdentifierBeforeDot items
ParenExpr
FunctionCallOrIdentifier
Identifier i
`)
})
test('not in scope remains Word with chained dots', () => {
expect('readme.md.bak').toMatchTree(`Word readme.md.bak`)
})
test('chained dot get in nested functions', () => {
expect(`do cfg:
do inner:
cfg.db.host
end
end`).toMatchTree(`
FunctionDef
Do do
Params
Identifier cfg
colon :
FunctionDef
Do do
Params
Identifier inner
colon :
FunctionCallOrIdentifier
DotGet
IdentifierBeforeDot cfg
DotGet
IdentifierBeforeDot db
Identifier host
keyword end
keyword end
`)
})
test('mixed simple and chained dot get', () => {
expect('obj = 1; obj.a; obj.b.c').toMatchTree(`
Assign
AssignableIdentifier obj
Eq =
Number 1
FunctionCallOrIdentifier
DotGet
IdentifierBeforeDot obj
Identifier a
FunctionCallOrIdentifier
DotGet
IdentifierBeforeDot obj
DotGet
IdentifierBeforeDot b
Identifier c
`)
})
test.skip('chained numeric dot get: row.2.1.b', () => {
expect('row = []; row.2.1').toMatchTree(`
Assign
AssignableIdentifier row
Eq =
Array []
FunctionCallOrIdentifier
DotGet
IdentifierBeforeDot row
DotGet
Number 2
DotGet
Number 1
Identifier b
`)
test('parses $.pid just fine', () => {
expect(`$.pid`).toMatchTree(`
FunctionCallOrIdentifier
DotGet
Dollar $
Identifier pid
`)
})
})
})

View File

@ -1,4 +1,5 @@
import { expect, describe, test } from 'bun:test'
import { parser } from '../shrimp'
import '../shrimp.grammar' // Importing this so changes cause it to retest!
@ -176,3 +177,159 @@ describe('pipe expressions', () => {
`)
})
})
describe('pipe continuation', () => {
test('pipe on next line', () => {
expect(`hello
| echo`).toMatchTree(`
PipeExpr
FunctionCallOrIdentifier
Identifier hello
operator |
FunctionCallOrIdentifier
Identifier echo
`)
expect(`echo hello
| grep h`).toMatchTree(`
PipeExpr
FunctionCall
Identifier echo
PositionalArg
Identifier hello
operator |
FunctionCall
Identifier grep
PositionalArg
Identifier h
`)
})
test('pipe on next non-empty line', () => {
expect(`hello
| echo`).toMatchTree(`
PipeExpr
FunctionCallOrIdentifier
Identifier hello
operator |
FunctionCallOrIdentifier
Identifier echo
`)
})
test('multi-line pipe chain', () => {
expect(`echo hello
| grep h
| sort`).toMatchTree(`
PipeExpr
FunctionCall
Identifier echo
PositionalArg
Identifier hello
operator |
FunctionCall
Identifier grep
PositionalArg
Identifier h
operator |
FunctionCallOrIdentifier
Identifier sort
`)
})
test('pipe with indentation', () => {
expect(`echo hello
| grep h
| sort`).toMatchTree(`
PipeExpr
FunctionCall
Identifier echo
PositionalArg
Identifier hello
operator |
FunctionCall
Identifier grep
PositionalArg
Identifier h
operator |
FunctionCallOrIdentifier
Identifier sort
`)
})
test('pipe after operand on next line (trailing pipe style)', () => {
expect(`echo hello |
grep h`).toMatchTree(`
PipeExpr
FunctionCall
Identifier echo
PositionalArg
Identifier hello
operator |
FunctionCall
Identifier grep
PositionalArg
Identifier h
`)
})
test('same-line pipes still work', () => {
expect('echo hello | grep h | sort').toMatchTree(`
PipeExpr
FunctionCall
Identifier echo
PositionalArg
Identifier hello
operator |
FunctionCall
Identifier grep
PositionalArg
Identifier h
operator |
FunctionCallOrIdentifier
Identifier sort
`)
})
test('lots of pipes', () => {
expect(`
'this should help readability in long chains'
| split ' '
| map (ref str.to-upper)
| join '-'
| echo
`).toMatchTree(`
PipeExpr
String
StringFragment this should help readability in long chains
operator |
FunctionCall
Identifier split
PositionalArg
String
StringFragment
operator |
FunctionCall
Identifier map
PositionalArg
ParenExpr
FunctionCall
Identifier ref
PositionalArg
DotGet
IdentifierBeforeDot str
Identifier to-upper
operator |
FunctionCall
Identifier join
PositionalArg
String
StringFragment -
operator |
FunctionCallOrIdentifier
Identifier echo
`)
})
})

View File

@ -8,7 +8,8 @@ describe('string interpolation', () => {
String
StringFragment ${'hello '}
Interpolation
Identifier name
FunctionCallOrIdentifier
Identifier name
`)
})
@ -44,7 +45,8 @@ describe('string interpolation', () => {
String
StringFragment x/
Interpolation
Identifier y
FunctionCallOrIdentifier
Identifier y
StringFragment /z
`)
})
@ -122,7 +124,8 @@ describe('string escape sequences', () => {
String
StringFragment value:
Interpolation
Identifier x
FunctionCallOrIdentifier
Identifier x
EscapeSeq \\n
`)
})

View File

@ -1,5 +1,5 @@
import { ExternalTokenizer, InputStream, Stack } from '@lezer/lr'
import { Identifier, AssignableIdentifier, Word, IdentifierBeforeDot, Do, CurlyString } from './shrimp.terms'
import { Identifier, AssignableIdentifier, Word, IdentifierBeforeDot, Do, CurlyString, DotGet, newline, pipeStartsLine } from './shrimp.terms'
// doobie doobie do (we need the `do` keyword to know when we're defining params)
export function specializeKeyword(ident: string) {
@ -187,11 +187,21 @@ const checkForDotGet = (input: InputStream, stack: Stack, pos: number): number |
const identifierText = buildIdentifierText(input, pos)
const context = stack.context as { scope: { has(name: string): boolean } } | undefined
// If identifier is in scope, this is property access (e.g., obj.prop)
// If not in scope, it should be consumed as a Word (e.g., file.txt)
return context?.scope.has(identifierText) || globals.includes(identifierText)
? IdentifierBeforeDot
: null
// Check if identifier is in scope (lexical scope or globals)
const inScope = context?.scope.has(identifierText) || globals.includes(identifierText)
// property access
if (inScope) return IdentifierBeforeDot
// Not in scope - check if we're inside a DotGet chain
// Inside the @skip {} block where DotGet is defined, Word cannot be shifted
// but Identifier can be. This tells us we're at the RHS of a DotGet.
const canShiftIdentifier = stack.canShift(Identifier)
const canShiftWord = stack.canShift(Word)
const inDotGetChain = canShiftIdentifier && !canShiftWord
// continue if we're inside a DotGet
return inDotGetChain ? IdentifierBeforeDot : null
}
// Decide between AssignableIdentifier and Identifier using grammar state + peek-ahead
@ -346,3 +356,34 @@ const isEmojiOrUnicode = (ch: number): boolean => {
}
const getCharSize = (ch: number) => (ch > 0xffff ? 2 : 1) // emoji takes 2 UTF-16 code units
export const pipeStartsLineTokenizer = new ExternalTokenizer((input: InputStream, stack: Stack) => {
const ch = input.peek(0)
if (ch !== 10 /* \n */) return
// ignore whitespace
let offset = 1
let lastNewlineOffset = 0
while (true) {
const ch = input.peek(offset)
if (ch === 10 /* \n */) {
lastNewlineOffset = offset
offset++
} else if (isWhiteSpace(ch)) {
offset++
} else {
break
}
}
// look for pipe after skipping empty lines
if (input.peek(offset) === 124 /* | */) {
input.advance(lastNewlineOffset + 1)
input.acceptToken(pipeStartsLine)
} else {
input.advance(1)
input.acceptToken(newline)
}
})

View File

@ -1,5 +1,6 @@
// The prelude creates all the builtin Shrimp functions.
import { join, resolve } from 'path'
import {
type Value, type VM, toValue,
extractParamInfo, isWrapped, getOriginalFunction,
@ -22,6 +23,20 @@ export const globals = {
math,
str,
// shrimp runtime info
$: {
args: Bun.argv.slice(3),
argv: Bun.argv.slice(1),
env: process.env,
pid: process.pid,
cwd: process.env.PWD,
script: {
name: Bun.argv[2] || '(shrimp)',
path: resolve(join('.', Bun.argv[2] ?? ''))
},
},
// hello
echo: (...args: any[]) => {
console.log(...args.map(a => {
@ -66,7 +81,6 @@ export const globals = {
},
// env
args: Bun.argv.slice(1),
exit: (num: number) => process.exit(num ?? 0),
// type predicates

View File

@ -80,15 +80,15 @@ describe('introspection', () => {
describe('environment', () => {
test('args is an array', async () => {
await expect(`array? args`).toEvaluateTo(true, globals)
await expect(`array? $.args`).toEvaluateTo(true, globals)
})
test('args can be accessed', async () => {
await expect(`type args`).toEvaluateTo('array', globals)
await expect(`type $.args`).toEvaluateTo('array', globals)
})
test('', async () => {
await expect(`list.first args | str.ends-with? 'shrimp.test.ts'`).toEvaluateTo(true)
test('argv includes more than just the args', async () => {
await expect(`list.first $.argv | str.ends-with? 'shrimp.test.ts'`).toEvaluateTo(true)
})
})
@ -103,3 +103,38 @@ describe('ref', () => {
expect(`rnd = ref math.random; rnd | type`).toEvaluateTo('number')
expect(`rnd = ref math.random; ref rnd | type`).toEvaluateTo('native')
})
describe('$ global dictionary', () => {
test('$.args is an array', async () => {
await expect(`$.args | array?`).toEvaluateTo(true, globals)
})
test('$.args can be accessed', async () => {
await expect(`$.args | type`).toEvaluateTo('array', globals)
})
test('$.script.name is a string', async () => {
await expect(`$.script.name | string?`).toEvaluateTo(true, globals)
})
test('$.script.path is a string', async () => {
await expect(`$.script.path | string?`).toEvaluateTo(true, globals)
})
test('$.env is a dict', async () => {
await expect(`$.env | dict?`).toEvaluateTo(true, globals)
})
test('$.pid is a number', async () => {
await expect(`$.pid | number?`).toEvaluateTo(true, globals)
await expect(`$.pid > 0`).toEvaluateTo(true, globals)
})
test('$.cwd is a string', async () => {
await expect(`$.cwd | string?`).toEvaluateTo(true, globals)
})
test('$.cwd returns current working directory', async () => {
await expect(`$.cwd`).toEvaluateTo(process.cwd(), globals)
})
})