I built DoScript, a domain-specific language for file automation. The goal: make scripts readable by anyone. Design Goal Instead of: bashfind . -type f -mtime +30 -exec rm {} \; Write: for_each file_in here if_older_than {file_name} 30 days delete file {file_path} end_if end_for Trade power for clarity. Optimize for maintenance over terseness. Key Design Decisions 1. Natural Language Keywords make folder not mkdir, copy file not cp. Self-documenting. 2. Implicit Metadata When iterating files, auto-inject: {file_name}, {file_path}, {file_size}, {file_modified}, {file_is_old_days} for_each file_in "Documents" say "{file_name} is {file_size} bytes" end_for 3. Built-in Time Handling if_older_than {file_name} 30 days make folder "backup_{today}" No date arithmetic needed. 4. Expression Evaluation Function-based for simplicity: if greater_than {file_size} 1000000 if and(equals({type}, "pdf"), greater_than({size}, 10000)) Intentionally awkward for complex logic - signals you should use Python. Implementation
Python interpreter (~2000 LOC) Recursive descent parser Context-aware error reporting Custom exception types with file/line info
Visual Component Built a browser-based node editor (single HTML file, 1200 LOC). Drag boxes, wire them, generate DoScript code. Why? Different learning styles, workflow visualization, non-programmer accessibility. What Worked
Natural syntax is immediately understandable Metadata injection removes boilerplate Time handling makes common cases trivial Visual IDE differentiates from text-only
What Didn't
Complex conditionals get awkward fast No user-defined functions (only macros) Limited data structures Performance not optimized
The Challenge Built for non-programmers. But they don't hang out on dev forums. Developers say "just use Python" - which misses the point. How do you market dev tools to non-developers? Technical Transparency I designed syntax and architecture. Most Python implementation was AI-assisted (Claude, Copilot). Focus on design, use tools for implementation. Open Questions
When does a DSL become too limited? How to market to non-developers? Type system worth the complexity? Should DSLs provide escape hatches to host language?
GitHub: https://github.com/TheServer-lab/DoScript v0.6.5, includes interpreter, visual IDE, VS Code extension, examples. Built because bash was too cryptic for my friend to organize files. Turns out lots of people have this problem. Would love feedback from people who've built DSLs or struggled with similar trade-offs.
Comments URL: https://news.ycombinator.com/item?id=47032476
Points: 1
# Comments: 0