Implementing a Rust Parser with Logos and LALRPOP for AST Construction
Project Setup
This guide demonstrates how to create a complete Rust application that combines logos for lexical analysis and lalrpop for parsing with abstract syntax tree (AST) generation. We'll build a mathematical expression processor with the following components:
Dependency Configuration
Begin by updating your Cargo.toml with the required ...
Posted on Mon, 03 Aug 2026 16:34:48 +0000 by AlGale
Understanding AST for Code Transformation
Exploring Abstract Syntax Tree (AST) manipulation to understand how obfuscation tools work.
The first step involves parsing JavaScript code into an AST structure:
let a,b=1;
// 注释
var obj = {
"name":1+3*2,
"func":function add(a,b){
let a1=3;
return a+b
}
}
function add(a,v){
return a+v;
}
let ...
Posted on Fri, 17 Jul 2026 17:16:36 +0000 by chrispols
Injecting External State into Parser Logic
Standard parser definitions typically operate solely on the input string. However, when generating an AST, you often need external context or configuration flags to influence how nodes are built.
Consider a scenario where you want to apply a multiplier to every numeric literal encountered during parsing. You can declare a state parameter direct ...
Posted on Sun, 05 Jul 2026 16:58:05 +0000 by zkent
Automated C++ Function Definition Insertion for Qt Signals
Building upon prior work that automatically inserts signal declarations into C++ header files, this article focuses on automating the insertion of corresponding function definitions into implementation (.cpp) files. Since .cpp files are generally less complex than headers—lacking class structures and access specifiers—their parsing and modifica ...
Posted on Sun, 17 May 2026 17:24:30 +0000 by $SuperString