A Robust and Efficient JSON Parser in Pure C

2025-03-01

This article details a JSON parser implemented entirely in C. Employing an object-oriented approach with functions attached to structs, it boasts improved readability and maintainability. Prioritizing safety, it avoids common memory leaks and segmentation faults. A clean, ergonomic API is provided, along with compilation instructions, usage examples, and best practices for C development, including compiler flags for robust code. The author demonstrates the use of variadic macros for inline JSON generation and efficient memory management techniques.

Read more
Development JSON Parsing

Highlighting Bash in Lua with Neovim and Treesitter

2025-01-28

The author built a tool to synchronize packages across multiple machines, using a Lua configuration file. To improve readability and editing of Bash scripts embedded within the Lua configuration, they leveraged Neovim and the Treesitter plugin. Treesitter, through its injection feature, identifies the `script` field in Lua tables and highlights its content as Bash based on a custom query. This significantly enhances code readability and maintainability. The post details the configuration of Neovim and Treesitter, along with the custom query to achieve the Bash highlighting.

Read more
Development

Embedding Lua in Rust for Configurable Static SQL Analysis in sqleibniz

2024-12-19

sqleibniz, a static SQL analysis tool for the SQLite dialect, has been enhanced with Lua scripting for increased configurability and extensibility. The author details the integration using the mlua crate in Rust, covering data structure conversion, Lua function calls, and error handling. Lua scripts allow users to define custom rules and hooks, enabling flexible static analysis such as customized diagnostics and style checks. This significantly improves sqleibniz's extensibility and user experience.

Read more
Development Static Analysis