diff options
Diffstat (limited to 'tree-sitter/dsk/dsk-cli/templates/default')
4 files changed, 183 insertions, 0 deletions
diff --git a/tree-sitter/dsk/dsk-cli/templates/default/README.md b/tree-sitter/dsk/dsk-cli/templates/default/README.md new file mode 100644 index 0000000..4560c6a --- /dev/null +++ b/tree-sitter/dsk/dsk-cli/templates/default/README.md @@ -0,0 +1,82 @@ +# __DSL_NAME__ + +A Domain-Specific Language created with DSK (DSL Development Kit). + +## Overview + +- **Language Type**: __PARADIGM__ +- **Purpose**: __PURPOSE__ +- **Data Philosophy**: __DATA_PHILOSOPHY__ + +## Getting Started + +### Prerequisites + +- [Tree-sitter CLI](https://tree-sitter.github.io/tree-sitter/creating-parsers#installation) +- Node.js or Bun (for JavaScript bindings) +- C compiler (gcc/clang) for native compilation + +### Development + +```bash +# Start development mode with file watching +dsk dev + +# Run tests +dsk test + +# Build parser and packages +dsk build + +# Generate editor syntax highlighting +dsk highlight + +# Package for distribution +dsk package +``` + +## Project Structure + +``` +__DSL_NAME__/ +├── grammar.js # Tree-sitter grammar definition +├── corpus/ # Test cases for the grammar +│ └── examples.txt +├── generated/ # Generated artifacts (created by dsk build) +│ ├── c/ # C static library +│ ├── js/ # JavaScript/Node.js package +│ └── editors/ # Editor configurations +└── examples/ # Example programs in your language + └── hello.__EXT__ +``` + +## Language Features + +__FEATURES_LIST__ + +## Grammar Rules + +The grammar includes rules for: + +- **Tokens**: Identifiers, numbers, strings, comments +- **Expressions**: Based on your language paradigm +- **Statements**: Control flow and declarations +- **Data Structures**: __DATA_STRUCTURES__ + +## Next Steps + +1. **Customize the Grammar**: Edit `grammar.js` to refine your language syntax +2. **Add Test Cases**: Create examples in `corpus/examples.txt` +3. **Write Example Programs**: Add sample code to `examples/` +4. **Generate Editor Support**: Run `dsk highlight` for syntax highlighting +5. **Build and Test**: Use `dsk dev` for iterative development + +## Resources + +- [Tree-sitter Documentation](https://tree-sitter.github.io/tree-sitter/) +- [DSK Documentation](https://github.com/your-org/dsk) +- [Language Implementation Patterns](https://pragprog.com/titles/tpdsl/) + +--- + +Generated by [DSK](https://github.com/your-org/dsk) - DSL Development Kit diff --git a/tree-sitter/dsk/dsk-cli/templates/default/corpus/examples.txt b/tree-sitter/dsk/dsk-cli/templates/default/corpus/examples.txt new file mode 100644 index 0000000..94f199e --- /dev/null +++ b/tree-sitter/dsk/dsk-cli/templates/default/corpus/examples.txt @@ -0,0 +1,85 @@ +================================================================================ +Basic Examples +================================================================================ + +Simple variable declaration +--- + +__VARIABLE_EXAMPLE__ + +--- + +(source_file + (statement + (variable_declaration + (identifier) + (expression (number))))) + +================================================================================ +Comments +================================================================================ + +Line comment +--- + +__COMMENT_EXAMPLE__ This is a comment +__VARIABLE_EXAMPLE__ + +--- + +(source_file + (statement + (variable_declaration + (identifier) + (expression (number))))) + +================================================================================ +Expressions +================================================================================ + +String literal via variable declaration +--- + +__VARIABLE_KEYWORD__ message __ASSIGNMENT_OPERATOR__ __STRING_EXAMPLE____TERMINATOR__ + +--- + +(source_file + (statement + (variable_declaration + (identifier) + (expression (string))))) + +================================================================================ +Numbers +================================================================================ + +Integer via variable declaration +--- + +__VARIABLE_KEYWORD__ count __ASSIGNMENT_OPERATOR__ __NUMBER_EXAMPLE____TERMINATOR__ + +--- + +(source_file + (statement + (variable_declaration + (identifier) + (expression (number))))) + +================================================================================ +Identifiers +================================================================================ + +Valid identifier via variable declaration +--- + +__VARIABLE_KEYWORD__ __IDENTIFIER_EXAMPLE__ __ASSIGNMENT_OPERATOR__ 42__TERMINATOR__ + +--- + +(source_file + (statement + (variable_declaration + (identifier) + (expression (number))))) diff --git a/tree-sitter/dsk/dsk-cli/templates/default/examples/hello.__EXT__ b/tree-sitter/dsk/dsk-cli/templates/default/examples/hello.__EXT__ new file mode 100644 index 0000000..07769f6 --- /dev/null +++ b/tree-sitter/dsk/dsk-cli/templates/default/examples/hello.__EXT__ @@ -0,0 +1,7 @@ +__COMMENT_EXAMPLE__ Hello World example for __DSL_NAME__ + +__PARADIGM_EXAMPLE__ + +__COMMENT_EXAMPLE__ More examples: +__VARIABLE_EXAMPLE__ +__VARIABLE_KEYWORD__ __IDENTIFIER_EXAMPLE__ __ASSIGNMENT_OPERATOR__ __STRING_EXAMPLE____TERMINATOR__ diff --git a/tree-sitter/dsk/dsk-cli/templates/default/package.json b/tree-sitter/dsk/dsk-cli/templates/default/package.json new file mode 100644 index 0000000..ab3d0c4 --- /dev/null +++ b/tree-sitter/dsk/dsk-cli/templates/default/package.json @@ -0,0 +1,9 @@ +{ + "name": "__DSL_NAME__-dsl", + "private": true, + "type": "commonjs", + "description": "DSL project for __DSL_NAME__ generated by DSK", + "license": "MIT" +} + + |