AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
翻译准备中
尚未检测到更新。GitHub 发布版本后会显示在这里。
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证A blazing-fast, modular, type-safe parser for OMG IDL 4.2 specification, written in Rust. Now with code generation for C, C++, Rust, and Python!
翻译准备中
取自仓库 README
正在加载完整 README。 以下为已保存的摘录。
High-assurance OMG IDL 4.2 parser and multi-language code generator for DDS (Data Distribution Service) applications.
hdds_gen is a Rust-based toolchain that parses OMG IDL 4.2 files and generates serialization code for multiple target languages. It provides CDR2 (Common Data Representation version 2) encode/decode implementations suitable for DDS middleware interoperability.查看完整 README ↗High-assurance OMG IDL 4.2 parser and multi-language code generator for DDS (Data Distribution Service) applications.
hdds_gen is a Rust-based toolchain that parses OMG IDL 4.2 files and generates serialization code for multiple target languages. It provides CDR2 (Common Data Representation version 2) encode/decode implementations suitable for DDS middleware interoperability.
Key capabilities:
| IDL Type | Description |
|---|---|
boolean | Boolean value |
char, wchar | 8-bit and wide characters |
octet | 8-bit unsigned |
short, unsigned short | 16-bit signed/unsigned |
long, unsigned long | 32-bit signed/unsigned |
long long, unsigned long long | 64-bit signed/unsigned |
float, double, long double | Floating-point types |
string, wstring | Unbounded strings |
string<N>, wstring<N> | Bounded strings |
int8, int16, int32, int64 | Fixed-width signed integers |
uint8, uint16, uint32, uint64 | Fixed-width unsigned integers |
fixed<D,S> | Fixed-point decimal (D digits, S scale) |
void | Void type (for operations) |
| Type | Description |
|---|---|
struct | Aggregated data structure with optional inheritance |
enum | Enumeration with optional explicit values |
union | Discriminated union with case labels |
typedef | Type alias with annotation support |
bitset | Packed bit fields with explicit widths |
bitmask | Named flag constants |
const | Constant definitions |
module | Namespace scoping |
forward declaration | Forward struct/union declarations |
@annotation | Custom annotation declarations |
| Type | Description |
|---|---|
sequence<T> | Unbounded sequence |
sequence<T, N> | Bounded sequence (max N elements) |
T[N] | Fixed-size array |
map<K, V> | Unbounded map |
map<K, V, N> | Bounded map (max N entries) |
With --features interfaces:
| Type | Description |
|---|---|
interface | Interface with operations and attributes |
exception | Exception type declarations |
oneway | One-way operations |
in/out/inout | Parameter direction qualifiers |
raises | Exception specifications |
| Annotation | Target | Description |
|---|---|---|
@key | Field | Marks field as part of topic key |
@optional | Field | Field may be absent |
@id(N) | Field | Explicit member ID |
@autoid(SEQUENTIAL|HASH) | Type | Auto-generate member IDs |
@extensibility(FINAL|APPENDABLE|MUTABLE) | Type | Type evolution policy |
@final | Type | Shorthand for FINAL extensibility |
@appendable | Type | Shorthand for APPENDABLE extensibility |
@mutable | Type | Shorthand for MUTABLE extensibility |
@must_understand | Field | Reader must understand this field |
@nested | Type | Nested type (no topic) |
@external | Field | External reference |
@default_literal | Enum | Default discriminator value |
@default | Union case | Default union case |
@position(N) | Bitset/Bitmask | Explicit bit position |
@bit_bound(N) | Enum/Bitmask | Maximum bit width |
@data_representation(XCDR1|XCDR2) | Type | Wire format selection |
@non_serialized | Field | Exclude from serialization |
| Annotation | Description |
|---|---|
@unit("...") | Unit of measurement |
@min(N) | Minimum value constraint |
@max(N) | Maximum value constraint |
@range(min=N, max=M) | Value range constraint |
@value(...) | Default value |
@verbatim(...) | Language-specific code injection |
| Annotation | Description |
|---|---|
@service | Mark interface as service |
@oneway | One-way operation (no reply) |
@ami | Asynchronous method invocation |
User-defined annotations via @annotation declarations with typed members and default values.
rust)#[derive(Debug, Clone, PartialEq)]Cdr2Encode / Cdr2Decode traitsOption<T> for @optional fieldsVec<T> for sequences, HashMap<K,V> for mapscpp)std::vector, std::map, std::array, std::string)--namespace-cppc)python)@dataclass decoratorstyping moduleIntEnum for enumerationsencode_cdr2_le() / decode_cdr2_le() methodscompute_key() for @key field hashingmicro) - no_std Rust#![no_std] compatible for embedded targetsheapless::Vec and heapless::Stringhdds-micro cratec-micro) - Header-Only C for MCUs# Install
cargo install --path .
# Parse and validate
hddsgen parse input.idl
hddsgen parse input.idl --pretty # Pretty-print parsed IDL
hddsgen parse input.idl --json # JSON diagnostics
# Check (validation only, CI-friendly exit codes)
hddsgen check input.idl
hddsgen check input.idl --json
# Generate code
hddsgen gen rust input.idl -o output.rs
hddsgen gen cpp input.idl -o output.hpp
hddsgen gen c input.idl -o output.h
hddsgen gen python input.idl -o output.py
hddsgen gen micro input.idl -o output.rs
hddsgen gen c-micro input.idl -o output.h
# Generate with namespace (C++)
hddsgen gen cpp input.idl --namespace-cpp MyApp::Types -o output.hpp
# Generate full project with examples
hddsgen gen rust input.idl --example --out-dir ./my_project
hddsgen gen cpp input.idl --example --out-dir ./my_project --build-system cmake
# Format IDL
hddsgen fmt input.idl -o formatted.idl
# Include directories for #include resolution
hddsgen parse main.idl -I ./includes -I /usr/share/idl
| Command | Description |
|---|---|
parse | Parse and validate IDL, optionally pretty-print |
gen | Generate code for target language |
check | Validate only (returns non-zero on error) |
fmt | Reformat IDL via pretty-printer |
| Option | Description |
|---|---|
-o, --out <FILE> | Output file (stdout if omitted) |
--out-dir <DIR> | Output directory for module files |
--namespace-cpp <NS> | C++ namespace (e.g., A::B::C) |
--example | Generate full project with publisher/subscriber examples |
--build-system <TYPE> | Build system: cargo, cmake, make |
--hdds-path <PATH> | Path to hdds crate for Rust examples |
-I, --include <DIR> | Include directory for #include resolution |
Full C-style preprocessor with:
#include "file.idl" and #include <file.idl>#define NAME value and #define MACRO(args) body#ifdef, #ifndef, #if, #elif, #else, #endif#undef##) and stringification (#)The validator enforces semantic correctness:
@key only on serializable fields@bit_bound limitsdefault case@default annotation consistency@position annotationsraises references existing exceptionsoneway operations must return voidsrc/
lib.rs # Public API exports
ast.rs # Abstract Syntax Tree types
types.rs # IDL type system (primitives, annotations)
token.rs # Lexer token definitions
error.rs # Error types and handling
lexer/ # Lexical analysis
mod.rs # Lexer entry point
scanner.rs # Character scanning
numbers.rs # Numeric literal parsing
state.rs # Lexer state machine
parser/ # Syntax analysis
mod.rs # Parser entry point
annotations.rs # Annotation parsing
const_expr.rs # Constant expression evaluation
interfaces.rs # Interface parsing (feature-gated)
types.rs # Type parsing
definitions/ # Definition parsers
structs.rs
enums.rs
unions.rs
bitsets.rs
bitmasks.rs
typedefs.rs
consts.rs
module.rs
forwards.rs
validate/ # Semantic validation
mod.rs # Validation entry point
engine.rs # Validation orchestration
rules/ # Validation rules
structs.rs
enums.rs
unions.rs
bitsets.rs
interfaces.rs
diagnostics.rs # Diagnostic types
references.rs # Reference resolution
codegen/ # Code generation
mod.rs # Backend trait and registry
rust_backend/ # Rust code generator
cpp/ # C++ code generator
c/ # C code generator
python.rs # Python code generator
micro/ # no_std Rust generator
c_micro/ # Header-only C for MCUs
examples.rs # Example code generation
examples_project.rs # Full project scaffolding
pretty/ # Pretty-printer
mod.rs # Formatter entry point
formatter.rs # Core formatting logic
structs.rs # Struct formatting
enums.rs # Enum formatting
unions.rs # Union formatting
bitsets.rs # Bitset formatting
modules.rs # Module formatting
interfaces.rs # Interface formatting (feature-gated)
bin/
hddsgen.rs # CLI entry point
hddsgen/
commands.rs # Subcommand implementations
preprocessor.rs # Preprocessor implementation
tests/ # Integration tests
examples/ # Example IDL files
canonical/ # Reference test cases
invalid/ # Expected-failure cases
include/ # Include resolution tests
macros/ # Preprocessor tests
interfaces/ # Interface feature tests
# Build
make build # Debug build
make release # Release build
# Test
make test # Unit tests
make validate-ci # Full CI validation suite
# Code quality
make fmt # Format code
make clippy # Run linter
make doc # Generate documentation
# Install
make install # Install to ~/.cargo/bin
| Feature | Description |
|---|---|
interfaces | Enable interface/exception parsing and pretty-printing |
# Build with interfaces support
cargo build --features interfaces
@extensibility(APPENDABLE)
struct HelloWorld {
unsigned long index;
string message;
};
module Comp {
@appendable
struct Msg {
@key int32_t id;
@optional string content;
string<16> name;
sequence<int32_t, 10> values;
};
enum Color { Red = 0, Green = 1, Blue = 2 };
typedef map<string, int32_t, 100> ConfigMap;
bitset Flags {
bitfield<3> mode;
bitfield<5> value, @position(4);
};
bitmask Permissions { Read, Write, Execute };
union Data switch(int32_t) {
case 1: int32_t integer;
default: octet raw;
};
const int32_t MAGIC = 42;
};
use hdds::{Cdr2Encode, Cdr2Decode};
let msg = Comp::Msg {
id: 1,
content: Some("Hello".to_string()),
name: "test".to_string(),
values: vec![1, 2, 3],
};
let mut buffer = [0u8; 256];
let size = msg.encode_cdr2_le(&mut buffer)?;
let (decoded, _) = Comp::Msg::decode_cdr2_le(&buffer)?;
assert_eq!(msg, decoded);
Licensed under either of:
at your option.
Copyright (c) 2025-2026 naskel.com