The invention provides an evidence-driven large
language model MISRA C rule review method and
system for
aviation safety. According to the method, formalized
feature extraction is carried out from four aspects of grammar structure features, semantic structure features,
logic analysis features and preprocessing behavior features for target codes according to various rules of MISRA C forcing class rules, and diagnosis information is diagnosed in combination with an industrial-grade
compiler; generating a structured evidence set comprising
abstract syntax tree node statistical features, code context structure features,
control flow graph features, function internal
data flow analysis features, symbol and type table features and
macro definition analysis features; and based on the structured evidence set and the large
language model, executing evidence tracing,
rule matching and
logical reasoning according to a preset thinking chain process, and outputting a structured judgment result containing illegal rule numbers, evidence description and code positions. According to the method, the
false alarm rate can be remarkably reduced while the high rule coverage rate and the detection accuracy are kept.