# robertkrimen/otto

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/robertkrimen-otto).**

8,439 stars · 601 forks · Go · MIT

## Links

- GitHub: https://github.com/robertkrimen/otto
- Homepage: http://godoc.org/github.com/robertkrimen/otto
- awesome-repositories: https://awesome-repositories.com/repository/robertkrimen-otto.md

## Description

Otto is a Go implementation of a JavaScript interpreter and embedded scripting engine. It provides a runtime environment for executing JavaScript code within native applications and includes a parser that converts source code into an abstract syntax tree for analysis and processing.

The project enables the creation of custom scripting interfaces by binding native Go functions into the JavaScript global scope. It also includes a utility to translate JavaScript regular expression patterns into compatible formats for other programming languages.

The engine supports safe script sandboxing through the enforcement of stack-depth limits and execution interruption to prevent resource abuse. It manages runtime efficiency through precompiled script caching, state cloning, and cross-language data exchange between Go and JavaScript types.

## Tags

### Programming Languages & Runtimes

- [JavaScript Engine Embedding](https://awesome-repositories.com/f/programming-languages-runtimes/c-library-embedding/runtime-embedding/webassembly-engine-embedding/javascript-engine-embedding.md) — Integrates a full JavaScript execution engine as a component within a Go host application.
- [JavaScript Runtimes](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/javascript-runtimes.md) — Provides a high-performance JavaScript engine for executing scripts within Go applications. ([source](https://cdn.jsdelivr.net/gh/robertkrimen/otto@master/README.md))
- [Cross-Language Data Exchange](https://awesome-repositories.com/f/programming-languages-runtimes/cross-language-data-exchange.md) — Facilitates the bidirectional movement of data between the Go host language and the JavaScript guest runtime.
- [Embedded Scripting Engines](https://awesome-repositories.com/f/programming-languages-runtimes/embedded-scripting-engines.md) — Implements a scripting language interpreter integrated into a host application for dynamic logic execution.
- [JavaScript Engines](https://awesome-repositories.com/f/programming-languages-runtimes/javascript-engines.md) — Provides a complete implementation of the JavaScript language runtime and interpreter in Go.
- [Go Native Bindings](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/native-c-interoperability/c-function-bindings/go-native-bindings.md) — Binds native Go system functions to the global script scope for invocation during execution. ([source](http://godoc.org/github.com/robertkrimen/otto))
- [Parsed AST Caching](https://awesome-repositories.com/f/programming-languages-runtimes/abstract-syntax-tree-parsing/parsed-ast-caching.md) — Caches precompiled abstract syntax trees to eliminate repeated parsing costs for the same script.
- [Script-Channel Integration](https://awesome-repositories.com/f/programming-languages-runtimes/go-concurrency-utilities/script-channel-integration.md) — Uses Go channels to signal the immediate interruption of script execution to prevent infinite loops.
- [JavaScript Source Parsers](https://awesome-repositories.com/f/programming-languages-runtimes/source-code-compilers/source-code-templates/source-code-transformation-engines/javascript-source-parsers.md) — Includes a parser that converts JavaScript source code into structured ASTs for program analysis.

### Data & Databases

- [Script-to-Native Type Mappings](https://awesome-repositories.com/f/data-databases/type-mapping-frameworks/script-to-native-type-mappings.md) — Translates JavaScript data types into equivalent Go structures for seamless communication between languages.
- [Script Compilation](https://awesome-repositories.com/f/data-databases/data-serialization-and-parsing/script-compilation.md) — Parses JavaScript source code into reusable handles to avoid redundant compilation costs during repeated executions. ([source](http://godoc.org/github.com/robertkrimen/otto))

### Development Tools & Productivity

- [Global Function Injection](https://awesome-repositories.com/f/development-tools-productivity/debugging-profiling-testing/debugging-diagnostics/debugging-inspection-tools/debugging-and-inspection-tools/runtime-debugging/global-function-injection.md) — Allows binding native Go functions into the JavaScript global namespace for script access.
- [Interpreter Stack Depth Limits](https://awesome-repositories.com/f/development-tools-productivity/search-paging-limits/crawl-depth-limiters/recursion-depth-control/interpreter-stack-depth-limits.md) — Enforces maximum stack depth and trace length to control memory usage and prevent stack overflow during execution. ([source](http://godoc.org/github.com/robertkrimen/otto))

### Software Engineering & Architecture

- [Tree-Walking Interpreters](https://awesome-repositories.com/f/software-engineering-architecture/abstract-syntax-tree-specifications/tree-walking-interpreters.md) — Implements an execution engine that evaluates JavaScript by directly traversing its abstract syntax tree.
- [Custom Scripting Engines](https://awesome-repositories.com/f/software-engineering-architecture/custom-scripting-engines.md) — Provides an embedded environment for executing custom JavaScript logic to extend application functionality.
- [Script Execution Interruptions](https://awesome-repositories.com/f/software-engineering-architecture/execution-interrupts/script-execution-interruptions.md) — Implements an interrupt channel to stop running scripts immediately, preventing infinite loops and resource exhaustion. ([source](http://godoc.org/github.com/robertkrimen/otto))
- [Interpreter Tree Walking](https://awesome-repositories.com/f/software-engineering-architecture/recursive-validation-engines/recursive-ast-traversal/interpreter-tree-walking.md) — Implements a tree-walking interpreter that executes JavaScript by traversing its abstract syntax tree.
- [Runtime State Namespaces](https://awesome-repositories.com/f/software-engineering-architecture/namespace-management/runtime-state-namespaces.md) — Manages the scoping and persistence of JavaScript objects and bindings within the live execution environment. ([source](http://godoc.org/github.com/robertkrimen/otto))
- [Runtime State Cloning](https://awesome-repositories.com/f/software-engineering-architecture/namespace-management/runtime-state-namespaces/runtime-state-cloning.md) — Allows duplicating current execution scopes and object bindings to instantiate similar runtimes quickly. ([source](https://cdn.jsdelivr.net/gh/robertkrimen/otto@master/README.md))
- [State Preservation Cloning](https://awesome-repositories.com/f/software-engineering-architecture/state-preservation-cloning.md) — Provides deep duplication of execution scopes and object bindings to create isolated runtime instances.
- [ESTree AST Parsing](https://awesome-repositories.com/f/software-engineering-architecture/trees/syntax-tree-construction/estree-ast-parsing.md) — Implements a parser that converts JavaScript source code into abstract syntax trees following the ESTree specification. ([source](http://godoc.org/github.com/robertkrimen/otto))

### DevOps & Infrastructure

- [Code Execution Sandboxes](https://awesome-repositories.com/f/devops-infrastructure/execution-environments/code-execution-runtimes/code-execution-sandboxes.md) — Provides a secure, isolated environment to execute untrusted JavaScript with limits on memory and time.

### Education & Learning Resources

- [Interpreter Stack Limits](https://awesome-repositories.com/f/education-learning-resources/depth-first-search-implementations/search-depth-limiting/ast-depth-limited-search/interpreter-stack-limits.md) — Tracks recursion depth to prevent memory exhaustion and stack overflow errors during script execution.

### Part of an Awesome List

- [Compilers and Interpreters](https://awesome-repositories.com/f/awesome-lists/devtools/compilers-and-interpreters.md) — JavaScript interpreter.
