dirac-browser
v0.1.1
Published
Browser-compatible Dirac language interpreter (no Node.js dependencies)
Maintainers
Readme
Dirac Browser
Browser-compatible version of the Dirac language interpreter with no Node.js dependencies.
Overview
dirac-lang-browser is a browser-safe implementation of the Dirac declarative execution language. It provides the same core functionality as dirac-lang but excludes Node.js-specific dependencies, making it suitable for client-side web applications.
Features
- ✅ Full Dirac language support (XML-based declarative execution)
- ✅ Subroutine composition with variable substitution
- ✅ Parameter passing with
{variable}syntax - ✅ Browser-compatible (no Node.js dependencies)
- ✅ TypeScript support
Installation
npm install dirac-lang-browserUsage
import { execute } from 'dirac-lang-browser';
const script = `
<subroutine name="greet">
<parameters select="@name"/>
<eval>
'Hello, ' + name + '!'
</eval>
</subroutine>
<call name="greet" name="World"/>
`;
const result = await execute(script);
console.log(result); // "Hello, World!"Recent Fixes
Variable Substitution in Nested Subroutine Calls (v0.1.0)
Fixed critical bug where variable substitution in nested <call> tags was not working correctly:
- ✅ Added support for
{var}pattern insubstituteVariables() - ✅ Added attribute substitution in
executeCallInternal()before parameter passing - ✅ Enables proper subroutine composition
Example that now works:
<subroutine name="set-background-color">
<parameters select="@color"/>
<eval>store.set('backgroundColor', color)</eval>
</subroutine>
<subroutine name="background">
<parameters select="@color"/>
<call name="set-background-color" color="{color}"/>
</subroutine>
<call name="background" color="red"/>Development
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm testLicense
MIT
Related Projects
- dirac-lang - Node.js version with full features
- dirac-angular-example - Example Angular app with LLM integration
