Method and device for parsing logical expressions

A technology of logical expressions and analytical methods, applied in the field of computer data processing, can solve problems such as error-prone and low efficiency, and achieve the effect of avoiding complex logical operations and improving the accuracy of operations

Active Publication Date: 2018-05-25
RUN TECH CO LTD BEIJING
View PDF5 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

This is particularly troublesome to implement, especially when encountering complex logical expressions, the efficiency is very low and error-prone

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
  • Method and device for parsing logical expressions
  • Method and device for parsing logical expressions

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0023] figure 1 Embodiment 1 of the present invention provides a logical expression parsing method, which can be executed by a logical expression parsing device, wherein the parsing device can be implemented by software and / or hardware, and can generally be integrated into a computer.

[0024] see figure 1 , the method of this embodiment includes the following steps:

[0025] Step S100, obtaining a logical expression to be parsed.

[0026] During coding, it may often be necessary to parse logical expressions. When parsing of a logical expression is required, the logical expression to be parsed input by the user may be obtained. A logical expression is a sequence composed of operators, operands, parentheses or relational symbols, etc. It is a formula formed by connecting constants, variables, functions, etc. with operators. Logical expressions are the most basic elements that make up program code. Please refer to the following logical expression 1 and logical expression 2:...

Embodiment 2

[0056] figure 2 It is a schematic structural diagram of an apparatus for parsing logical expressions provided by Embodiment 2 of the present invention. The analysis device is configured in a computer. The parsing device in this embodiment specifically includes: an acquisition module 21 , a split module 22 , a value calculation module 23 , a substitution module 24 and a result calculation module 25 .

[0057] Wherein, the acquiring module 21 is configured to acquire the logic expression to be parsed. The logical expression may be a mixed expression or a general expression.

[0058] A splitting module 22, configured to split the logical expression to be parsed to obtain at least one operation unit. The above splitting is splitting by using a regular expression mixed expression to obtain at least one computing unit.

[0059] The value operation module 23 is configured to perform an operation on each operation unit to obtain an operation value of each operation unit. That is...

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

Embodiments of the invention disclose a logic expression analysis method and apparatus. The analysis method comprises: obtaining a to-be-analyzed logic expression; splitting the to-be-analyzed logic expression to obtain at least one arithmetic unit; performing arithmetic for the at least one arithmetic unit to obtain an arithmetic value of each arithmetic unit; substituting the arithmetic value of each arithmetic unit into the to-be-analyzed logic expression; and performing arithmetic for the to-be-analyzed logic expression into which the arithmetic value is substituted to obtain a final result. According to the logic expression analysis method and apparatus, complicated logic arithmetic of an existing analysis method is avoided, the result can be quickly obtained by arithmetic, and the correctness of arithmetic is improved.

Description

technical field [0001] The embodiments of the present invention relate to the technical field of computer data processing, and in particular to a method and device for analyzing logical expressions. Background technique [0002] In various coding processes, we often encounter scenarios where logical expressions need to be parsed. Usually, the form of a logical expression is as follows: "=", ">", "<" or "in" and other basic operation units connected by operators, and the operation units are connected by "&" or "|" relational symbols, And there may be logical expressions formed by combining multiple parentheses. In the process of parsing and operation, the precedence level of operators is: arithmetic operator>character operator>relational operator>logical operator>assignment operator. [0003] For logical expressions, the usual analytical operation method is: split the logical expression according to the priority of the operator; start to calculate the resu...

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): G06F9/305
CPCG06F9/30029
Inventor 刘旭
Owner RUN TECH CO LTD BEIJING
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products