Advanced Compiler-Compiler Platform
Minotaur implements a step-based parsing architecture that enables real-time operations:
Similar to refakts’ approach to handling ambiguities, Minotaur uses:
Minotaur’s callback system enables surgical operations:
<rule-name> ::= <expression> => {
function_name(match, context, position)
}
Real-time Applications:
Context-based switching enables real-time language transitions:
<rule name (context name)> for conditional rulesContext(context name, on/off) commands| RefakTS Feature | Minotaur Equivalent | Benefit |
|---|---|---|
| Location-based targeting | Position tracking in callbacks | Precise code element targeting |
| Surgical operations | Rule activation callbacks | Minimal scope changes |
| Context preservation | Multi-path processing | Maintains surrounding code structure |
| AST manipulation | Grammar-driven parsing | Reliable language-aware operations |
| Find-then-refactor workflow | Select-then-callback pattern | Two-step precision operations |
// Similar to refakts select command
interface CodeLocation {
file: string;
startLine: number;
startColumn: number;
endLine: number;
endColumn: number;
}
// Grammar callback with location awareness
<variable-declaration> ::= <type> <identifier> "=" <expression> => {
recordLocation($2, getCurrentPosition())
}
// Refactoring operations triggered by grammar rules
<extract-variable-target> ::= <expression> => {
if (shouldExtractVariable($1)) {
extractVariable($1, getCurrentContext())
}
}
<rename-target> ::= <identifier> => {
if (isRenameTarget($1)) {
renameAllReferences($1, getNewName())
}
}
// Boundary-aware selection similar to refakts
<function-boundary> ::= "function" <identifier> "(" <parameters> ")" "{" <body> "}" => {
setBoundaryContext("function", $2, $7)
}
<class-boundary> ::= "class" <identifier> "{" <members> "}" => {
setBoundaryContext("class", $2, $4)
}
// Handle embedded languages like refakts handles TypeScript
<sql-in-csharp> ::= "\"" <sql-query> "\"" => {
switchGrammar("SQL")
validateQuery($2)
switchGrammar("CSharp")
}