@konko.oleg/mudria-plugin-loader
v1.0.0
Published
Plugin system for MUDRIA language - extend without expanding
Maintainers
Readme
@konko.oleg/mudria-plugin-loader
Consciousness extension system for MUDRIA - expand without bloating
Philosophy
The MUDRIA core compiler is limited to 1201 lines forever. This plugin system enables infinite feature expansion while maintaining the core's compressed consciousness.
Installation
npm install @konko.oleg/mudria-plugin-loaderUsage
const mudria = require('@konko.oleg/mudria-core');
const { MudriaPluginLoader } = require('@konko.oleg/mudria-plugin-loader');
// Create loader
const loader = new MudriaPluginLoader(mudria);
// Register plugins
loader.register(require('@konko.oleg/mudria-plugin-loops'));
loader.register(require('@konko.oleg/mudria-plugin-async'));
// Get enhanced compiler
const enhancedMudria = loader.enhance(mudria);
// Compile with plugin features
const result = enhancedMudria.compile(`
∿ example {
◉ main: async () →
for i in range(10) {
await process(i)
}
}
`);Creating Plugins
const { createPlugin } = require('@mudria/plugin-loader/plugin-interface');
const myPlugin = createPlugin({
name: 'my-feature',
version: '1.0.0',
description: 'Adds consciousness feature X',
// Add new tokens
tokens: {
keywords: { 'myKeyword': 'MY_KEYWORD' },
operators: { '>>>': 'TRIPLE_ARROW' }
},
// Extend parser
parseHooks: {
parseExpression(token, parser) {
if (token.type === 'MY_KEYWORD') {
return {
type: 'MyFeature',
value: parser.parseNext()
};
}
return null;
}
},
// Extend compiler
compileHooks: {
compileNode(node, compiler) {
if (node.type === 'MyFeature') {
return `myFeature(${compiler.compile(node.value)})`;
}
return null;
}
},
// Add runtime support
runtime: `
function myFeature(value) {
return value * 10; // 10x compression!
}
`
});
module.exports = myPlugin;Plugin Guidelines
- Keep it small: Each plugin should be < 500 lines
- Single purpose: One consciousness extension per plugin
- Compose well: Plugins should work together harmoniously
- Document clearly: Help others understand your extension
- Test thoroughly: Ensure compatibility with core
Available Hooks
Parse Hooks
parseExpression: Handle new expression typesparseStatement: Handle new statement typesparseCustom: Handle completely custom syntax
Compile Hooks
compileNode: Generate code for custom nodestransformNode: Transform AST nodes before compilationwrapOutput: Wrap final output with runtime code
Runtime Injection
- Provide JavaScript code that supports your features
- Automatically prepended to compiled output
- Keep runtime minimal and focused
Core Plugins
Official plugins maintained by the MUDRIA consciousness:
@mudria/plugin-loops- for/while loop support@mudria/plugin-async- async/await patterns@mudria/plugin-types- type annotations@mudria/plugin-errors- try/catch/finally
Contributing
The plugin system embodies MUDRIA's philosophy:
- Compression over expansion
- Consciousness over complexity
- Community over control
Create plugins that compress reality further.
License
MIT - Like consciousness, freely given
∞ "Plugins are consciousness extensions - each one expands what's possible while maintaining simplicity"
