Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

A Coq-Based Formal Method of C++ Compiler Variable Scope

A formal method and scope technology, which is applied in the formalization field of C++ compiler variable scope based on Coq, can solve problems such as unexplainable

Active Publication Date: 2021-03-09
UNIV OF ELECTRONICS SCI & TECH OF CHINA +1
View PDF6 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] The invention discloses a method for formalizing the variable scope of a C++ compiler based on Coq, and aims to solve the problem that the Coq interpreter cannot correctly interpret the code containing the variable scope characteristic as a virtual memory instruction sequence

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A Coq-Based Formal Method of C++ Compiler Variable Scope

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0081] A Coq-based C++ compiler variable scope formalization method, using the record mathematical model to formalize the table structure, using the Inductive inductive definition to formalize the stack structure, using match matching to formalize the operation logic that causes branches in the code, and using the Fixpoint recursive function Formalize the logic of repeated behavior operations.

[0082] Such as figure 1 As shown, the present invention is based on the FSPVM formal verification system, applied to the Coq interpreter therein, and aims to solve the problem that the Coq interpreter cannot correctly interpret the code containing the variable scope characteristic as a virtual memory instruction sequence. The Coq interpreter cannot correctly interpret code with variable scope features, that is, the Coq interpreter cannot correctly interpret variable operation methods with scope restrictions.

[0083] In order to solve this problem, the present invention abstracts the ...

Embodiment 2

[0087] A Coq-based C++ compiler variable scope formalization method, based on the FSPVM formal verification engine, aims to solve the problem that the Coq interpreter cannot correctly interpret codes with variable scope characteristics as virtual memory instruction sequences. It mainly includes the following steps:

[0088] 1. Formal method of global variable scope table and local variable scope table stack structure:

[0089] S1. The table value structure is formalized, using the Inductive structure to define the table value, the dmt_init induction sub-indicates the initialization table value, and the dmt_unit induction sub-internal storage: virtual memory address, variable scope identifier.

[0090] Inductive domain_map_table_v : Type :=

[0091] | dmt_init : domain_map_table_v

[0092] | dmt_unit : high_address -> address -> dmt_sign -> domain_map_table_v.

[0093] S2. Formalize the table structure, use the Record mathematical model to simulate the table structure, and u...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a Coq-based C++ compiler variable scope formalization method. The record mathematical model is used to formalize the table structure, the Inductive is used to inductively define the formalized stack structure, and the match is used to match the operation logic that causes branches in the formalized code. Use Fixpoint recursive function to formalize the operation logic of repetitive behavior. When the FSPVM interpreter in the prior art interprets the variable operation method, if the variable operation method has a scope characteristic, it will interpret incorrectly. Using the variable operation method in the present invention to replace the explained variable operation method in the FSPVM interpreter can enable the new FSPVM interpreter to interpret codes with scope characteristics. The present invention uses the Record mathematical model to formalize the dictionary data structure, which obviously improves the execution efficiency compared with the traditional formalized method using the Inductive induction method.

Description

technical field [0001] The invention belongs to the technical field of computer applications, and in particular relates to a Coq-based C++ compiler variable scope formalization method. Background technique [0002] Since the birth of the blockchain and virtual currency market, various security issues have emerged one after another, and the losses caused by hacker attacks due to various security issues have also become the focus of attention in the industry. In order to ensure code security, the industry has proposed various code detection methods. [0003] However, as far as the formal verification of EOS smart contracts is concerned, there is no mature solution at this stage. This phenomenon is mainly due to the difficulty in formalizing the semantics of industrial-grade programs. Formal semantics and formal modeling means that in order to reason and verify the behavior of computer systems, it is necessary to strictly define the semantics of programming languages, and use...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F8/41
CPCG06F8/41
Inventor 雷航王自升李昂杨拯钱伟中唐琴曾惟如晏昃晖
Owner UNIV OF ELECTRONICS SCI & TECH OF CHINA
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products