| src | ||
| .gitattributes | ||
| .gitignore | ||
| build.ts | ||
| bun-env.d.ts | ||
| bun.lock | ||
| bunfig.toml | ||
| CLAUDE.md | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
Shrimp Language
Overview
Shrimp is a shell-like scripting language that combines the simplicity of command-line interfaces with functional programming concepts. Built using Lezer (CodeMirror's parser system) with TypeScript.
Language Design Philosophy
- Everything is an expression - Commands, assignments, and functions all return values
- Whitespace matters - Spaces distinguish operators from identifiers (e.g.,
x-1is an identifier,x - 1is subtraction) - Shell-like command syntax -
echo hello worldworks naturally - Named arguments without quotes -
tail file.txt lines=30 - Unbound symbols become strings -
echo hellotreatshelloas a string if not defined - Simplicity over cleverness - Each feature should work one way, consistently. Two simple features that are easy to explain beat one complex feature that requires lots of explanation
Current Status & Goals
Today's Implementation Goals
- ✅ Interpreter Setup - Renamed evaluator to interpreter for clarity
- Command Execution - Support calling external commands and built-in functions
- Variable Assignment - Implement assignment with validation using Lezer context tracking
Parser Features
- ✅ Distinguishes between identifiers (assignable) and words (non-assignable)
- ✅ Smart tokenization for named args (
lines=30splits, but./path=valuestays together) - ✅ Handles ambiguous cases (bare identifier could be function call or variable reference)
Grammar Architecture
See src/parser/example.shrimp for language examples and src/parser/shrimp.grammar for the full grammar.
Key Token Types
- Identifier - Lowercase/emoji start, can contain dashes/numbers (assignable)
- Word - Any non-whitespace that isn't a valid identifier (paths, URLs, etc.)
- FunctionCall - Identifier followed by arguments
- FunctionCallOrIdentifier - Ambiguous case resolved at runtime