CN102521291B - ANTLR (Another Tool for Language Recognition)-based importing method for LDF (Log Data File) of description file of LIN (Local Interconnect Network) - Google Patents

ANTLR (Another Tool for Language Recognition)-based importing method for LDF (Log Data File) of description file of LIN (Local Interconnect Network) Download PDF

Info

Publication number
CN102521291B
CN102521291B CN201110386945.8A CN201110386945A CN102521291B CN 102521291 B CN102521291 B CN 102521291B CN 201110386945 A CN201110386945 A CN 201110386945A CN 102521291 B CN102521291 B CN 102521291B
Authority
CN
China
Prior art keywords
ldf
file
antlr
information
abstract semantics
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201110386945.8A
Other languages
Chinese (zh)
Other versions
CN102521291A (en
Inventor
李红
杨国青
孙征
钟晓峰
耿莉莉
赵民德
吴朝晖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CN201110386945.8A priority Critical patent/CN102521291B/en
Publication of CN102521291A publication Critical patent/CN102521291A/en
Application granted granted Critical
Publication of CN102521291B publication Critical patent/CN102521291B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention discloses an ANTLR (Another Tool for Language Recognition)-based importing method for the LDF (Log Data File) of a description file of an LIN (Local Interconnect Network). The method comprises the following steps of: compiling the grammar according with an open-source language recognizer specified by an ANTLR by using the grammar of an LDF code specified by the bus version of an LIN, and combining to obtain a grammar file of the LDF; importing the grammar file to the ANTLR, setting the parameter configuration of the ANTLR, and obtaining an accidence recognizer and a syntax recognizer for the LDF; generating a traversal for an abstract semantic tree by the ANTLR, compiling a grammar file for the traversal abstract semantic tree, traversing the elements in the grammar file of the LDF by the traversal according to the compiled grammar file for the traversal abstract semantic tree, extracting information required for application, and defining a certain logic as required; importing the LDF and obtaining an abstract semantic tree of the LDF through the accidence recognizer and the syntax recognizer; and finishing the conversion from the abstract semantic tree to a specific memory model through traversing the information of nodes of the abstract semantic tree by the traversal, combining a self-defined LDF element model and removing the redundant information from the abstract semantic tree.

Description

The introduction method of a kind of LIN network description file LDF based on ANTLR
Technical field
The present invention relates to the network design technology in automotive electronics software development, especially relate to the introduction method of a kind of LIN network description file LDF based on ANTLR.
Background technology
LIN(Local Interconnect Network) being a kind of vehicle-mounted Intranet cheaply, is that one of existing vehicle-mounted complex network is supplemented.LIN attempts to carry out further improving performance by realizing the In-vehicle networking of classification, reduces the cost of exploitation, generation, service and logistics in automotive electronics simultaneously.With CAN(Controller Area Network, controller local area network) bus compares, and LIN bus has smaller bandwidth, and complicacy is also relatively low.LDF is a kind of configuration information description document of LIN bus.It mainly comprises the following information of LIN bus: bus version information, Bus Speed definition, communication node definition, communication node attribute definition, signal definition (also having diagnostic signal), the definition of signal group, frame definition (also having dynamic frame, discrete frames, Event triggered frame and diagnosis frame), dispatch list definition etc.The all elements defining in LDF file is all have specific standard grammatical, meets BNF(Backus-Naur Form) Bacchus-Nore normal form.The design that can effectively carry out LIN bus by LDF defines the communication bunch based on LIN bus simultaneously.
The speech recognizer ANTLR increasing income, compared with Lex/Yacc, ANTLR provides a more powerful speech recognition framework.It can, according to user-defined grammatical file, generate morphology recognizer and the grammatical recognizer of plurality of target language (Java, C#, C++, Python etc.).Meanwhile, ANTLR recovers to provide very effective support to the processing of semantic tree, error reporting, mistake.
Network design process in automotive electronics software development at present, generally can not start from scratch and carry out the design of particular network.Zero-based network design is the process of a more complicated.If can provide one efficiently, the design tool of similar DaVinci Network Designer intuitively, can improve the efficiency of network configuration so to a certain extent.Nowadays the method conventionally adopting is to import existing network model, carries out relevant configuration and comes Rapid Establishment to meet the network model of application needs.
LDF file has good readability.Based on this point, although thereby can directly process based on text-string the object that LDF file reaches importing.But the processing based on text-string lacks accuracy, efficiency is lower, and more loaded down with trivial details, and complexity is higher.
To sum up, face in order to make full use of the demand of existing network model, especially in order to meet AUTOSAR(automobile open system framework, the specific demand of the network design that Automotive Open System Architecture) in methodology, the system configuration stage carries out, needs a kind of method that correctly imports efficiently LDF file.
Summary of the invention
In order effectively to utilize the development of existing network design, overcome fallibility, poor efficiency and loaded down with trivial details shortcoming that the file lead-in mode based on text-string brings, the invention provides a kind of efficient LDF file introduction method and complete the effective utilization to existing LIN bus network model.
In order to solve the problems of the technologies described above, technical scheme of the present invention is as follows:
An introduction method of the LIN network description file LDF of ANTLR, comprises the steps:
1) utilize the syntax of the LDF standard of LIN bus version regulation, write the syntax that meet the speech recognizer ANTLR regulation of increasing income, combination obtains LDF syntax file;
2) by the LDF syntax file described in step 1) is imported in described ANTLR, the parameter configuration in ANTLR is set, generates the morphology recognizer and the speech recognizer that obtain LDF file;
3) by described ANTLR, generate described abstract semantics traversal of tree device, write the grammatical file of traversal abstract semantics tree, described walker travels through for the element in described LDF syntax file according to the grammatical file of the traversal abstract semantics tree of writing, extract the information that application needs, and can define on demand certain logic;
4) importing LDF file by step 2) described morphology recognizer and speech recognizer obtain its abstract semantics and set;
5) by the walker described in step 3), travel through described abstract semantics and set each nodal information, in conjunction with self-defining LDF element class model, remove the redundant information in described abstract semantics tree, complete the conversion of setting concrete internal memory class model from abstract semantics.
Further, described LDF file comprises bus version information element, Bus Speed definition element, communication node definition element, communication node attribute definition element, signal definition element, signal group definition element, frame definition element, and dispatch list defines element and meets BNF normal form.
Further, described step 5) in, when setting each nodal information, finishes when finding not have to travel through the described abstract semantics of traversal, obtain non-leaf nodes information with and all child node information, judge whether child node is all leaf node, if not continue to obtain non-leaf nodes information with and all child node information, if it is merge all child node information and in conjunction with self-defining LDF element class model, remove the redundant information in described abstract semantics tree, complete the conversion of setting concrete internal memory class model from abstract semantics.
Further, described LDF file meets LIN2.0 network standard.
The present invention has following beneficial effect:
1. the present invention supports the importing of the LDF file of LIN2.0 standard, the speech recognizer ANTLR increasing income, for the importing of LDF file provides strong support, very the processing LDF file of convenient and efficient, has avoided the fallibility based on text character string manipulation loaded down with trivial details.
2. the present invention is based on ANTLR, its importing for LDF file provides powerful framework support, can be according to actual application needs, when traversal abstract semantics tree, do self-defining business logic processing, while is also for the checking of LDF file provides condition, be conducive to identify the file that does not meet LDF syntax gauge, even can realize wrong location.
3. the present invention supports the LIN bus network model importing can effectively utilize existing development, for carrying out the iterative development of network model, or carrying out network configuration, network analysis and diagnosis provides the foundation, also for meeting the specific demand of the network design that in AUTOSAR methodology, the system configuration stage carries out, provide condition, enriched the development approach of AUTOSAR simultaneously.
Accompanying drawing explanation
Fig. 1 main process flow diagram of the present invention;
The part abstract semantics tree schematic diagram of Fig. 2 embodiment of the present invention;
The concrete internal memory class model of the part schematic diagram of Fig. 3 embodiment of the present invention.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention is described further.
An introduction method of the LIN network description file LDF of ANTLR, comprises the steps:
1) utilize the syntax of the LDF standard of LIN bus version regulation, write the syntax that meet the speech recognizer ANTLR regulation of increasing income, combination obtains LDF syntax file;
2) by the LDF syntax file described in step 1) is imported in described ANTLR, the parameter configuration in ANTLR is set, generates the morphology recognizer and the speech recognizer that obtain LDF file;
3) by described ANTLR, generate described abstract semantics traversal of tree device, write the grammatical file of traversal abstract semantics tree, described walker travels through for the element in described LDF syntax file according to the grammatical file of the traversal abstract semantics tree of writing, extract the information that application needs, and can define on demand certain logic;
4) importing LDF file by step 2) described morphology recognizer and speech recognizer obtain its abstract semantics and set;
5) by the walker described in step 3), travel through described abstract semantics and set each nodal information, in conjunction with self-defining LDF element class model, remove the redundant information in described abstract semantics tree, complete the conversion of setting concrete internal memory class model from abstract semantics.
Technical conceive of the present invention is: LDF file is a kind of preservation form of LIN bus network configuration.If can make full use of the demand of existing network model, especially in order to meet the specific demand of the network design that in AUTOSAR methodology, the system configuration stage carries out, the method that imports so efficiently LDF file must be conducive to the network model that Rapid Establishment meets application needs, and then can improve the efficiency of network configuration.
LDF document definition all total line elements of LIN, and the syntax of these elements are standards, meet BNF normal form.The speech recognizer ANTLR that increases income supports the syntax of BNF normal form, can generate morphology recognizer and the speech recognizer of different target language, and the effective support that provides the processing of abstract semantics tree and error reporting, mistake to recover.
The grammar definition of LDF standard, adds the efficient speech recognizer that ANTLR increases income, and for the importing (identifying and be converted into memory model) of LDF file provides very efficiently, supports.Based on ANTLR, import existing LIN bus network model and can effectively utilize existing development, for carrying out the iterative development of network model, or carry out network configuration, network analysis and diagnosis and provide the foundation.
Fig. 1 has pointed out main process flow diagram of the present invention, specific as follows:
11) write LDF syntax file.
12) by ANTLR, generate morphology recognizer and speech recognizer.
13) by ANTLR, generate abstract semantics tree walker.
(13.1) write the grammatical file of traversal abstract semantics tree.
(13.2) based on ANTLR, import LDF syntax file, finally generate abstract semantics tree walker.
14) import any one LDF file and obtain its abstract semantics tree.
15) be converted into concrete internal memory class model.
Detailed step is described as follows:
Step 1, writes LDF syntax file.LDF document definition all total line elements of LIN, and the syntax of these elements are standards, meet BNF normal form.The element that LDF mainly comprises is as follows: bus version information, Bus Speed definition, communication node definition, communication node attribute definition, signal definition (also having diagnostic signal), the definition of signal group, frame definition (also having dynamic frame, discrete frames, Event triggered frame and diagnosis frame), dispatch list definition etc.Some difference in the definition of element in different LIN bus version (1.3,2.0,2.1, J2602_1_1.0).Need to write the syntax that meet ANTLR regulation for the syntax of each element, the final synthetic syntax that obtain whole LDF file.In this application case, the LDF syntax are to meet LIN2.0 standard.The LDF syntax that now obtain not are the syntax for certain LDF file, therefore write the LDF syntax file obtaining and have versatility.
Step 2, generates morphology recognizer and speech recognizer by ANTLR.Speech recognizer ANTLR based on increasing income, import the LDF syntax file that step 1 is write, add that the target language that some simple parameter configuration: language=Java(generates is Java simultaneously), output=AST(identification is output as abstract semantics tree) etc., can generate the morphology recognizer and the speech recognizer that obtain LDF file.In this application case, the version that ANTLR adopts is ANTLR 3.X.Because LDF syntax file has versatility, the morphology recognizer and the speech recognizer that therefore by ANTLR, generate have versatility too.After completing steps 2, now possessed the ability of any LDF file of identification.
Step 3, generates abstract semantics tree walker by ANTLR.Write the grammatical file of traversal abstract semantics tree, walker travels through for the element in LDF syntax file according to the grammatical file of abstract semantics tree, extracts the information that application needs, and can define certain logic simultaneously.In this application case, the syntax of abstract semantics walker are corresponding with the LDF syntax standard in step 1.Because LDF syntax file has versatility, the abstract semantics tree walker therefore generating by ANTLR has versatility too.After completing steps 3, now possessed the ability that imports any LDF file.
Step 4, imports any one LDF file and obtains its abstract semantics tree.LDF file can carry out hand-coding according to the syntax of LDF.Hand-coding is more loaded down with trivial details, and workload is larger, and fallibility.At present thereby general LDF file is all to utilize the design tool of existing similar DaVinci Network Designer to carry out network design to generate and obtain.In this application case, what directly use is the LDF file that meets LIN2.0 standard in the LIN demo that provides of CANoe 7.0.Fig. 2 has provided importing LDF file and has obtained some the important element nodes in its corresponding abstract semantics tree.From Fig. 2, can find that this LDF meets LIN2.0 standard, Bus Speed is 19.2kbps; The master node that has a host node 1 by name in this LIN bus, its time reference is 5ms, has the shake of a 0.1ms; Have two slave nodes, name is respectively: from node 1, from node 2; In addition also have signal messages all in bus, frame information, schedule information etc.Meanwhile, also can find that this abstract semantics tree exists a certain amount of meaningless information, such as comma, branch, parantheses etc., they are mainly used in standardization and the readability of the LDF syntax.
Step 5, is converted into concrete internal memory class model.The abstract semantics tree walker generating based on step 3, in conjunction with self-defining LDF element class model, can remove the redundant information in abstract semantics tree according to application demand, concrete as shown in Fig. 1 right-hand component, by ANTLR, generate abstract semantics traversal of tree device, when setting each nodal information, finishes when finding not have to travel through this walker traversal abstract semantics, obtain non-leaf nodes information with and all child node information, judge whether child node is all leaf node, if not continue to obtain non-leaf nodes information with and all child node information, if it is merge all child node information and be converted into corresponding internal memory class model.The final conversion that becomes to set concrete internal memory class model from abstract semantics.In this application case, Fig. 3 has provided concrete memory model corresponding to abstract semantics tree of describing in Fig. 2.
The above is only the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, without departing from the inventive concept of the premise; can also make some improvements and modifications, these improvements and modifications also should be considered as in protection domain of the present invention.

Claims (3)

1. an introduction method of the LIN network description file LDF based on ANTLR, is characterized in that, comprises the steps:
1) utilize the syntax of the LDF standard of LIN bus version regulation, write the syntax that meet the speech recognizer ANTLR regulation of increasing income, combination obtains LDF syntax file;
2) by the LDF syntax file described in step 1) is imported in described ANTLR, the parameter configuration in ANTLR is set, generates the morphology recognizer and the speech recognizer that obtain LDF file;
3) by described ANTLR, generate abstract semantics traversal of tree device, write the grammatical file of traversal abstract semantics tree, described walker travels through for the element in described LDF syntax file according to the grammatical file of the traversal abstract semantics tree of writing, extracts the information that application needs;
4) importing LDF file by step 2) described morphology recognizer and speech recognizer obtain its abstract semantics and set;
5) by the walker described in step 3), travel through described abstract semantics and set each nodal information, in conjunction with self-defining LDF element class model, remove the redundant information in described abstract semantics tree, complete the conversion of setting concrete internal memory class model from abstract semantics;
When described step 5), the described abstract semantics of traversal is set each nodal information, when having traversal, discovery do not finish, obtain non-leaf nodes information with and all child node information, judge whether child node is all leaf node, if not continue to obtain non-leaf nodes information with and all child node information, if it is merge all child node information and in conjunction with self-defining LDF element class model, remove the redundant information in described abstract semantics tree, complete the conversion of setting concrete internal memory class model from abstract semantics.
2. the introduction method of a kind of LIN network description file LDF based on ANTLR according to claim 1, it is characterized in that, described LDF file comprises bus version information element, Bus Speed definition element, communication node definition element, communication node attribute definition element, signal definition element, signal group definition element, frame definition element, and dispatch list defines element and meets Bacchus-Nore normal form.
3. the introduction method of a kind of LIN network description file LDF based on ANTLR according to claim 1, is characterized in that, described LDF file meets LIN2.0 network standard.
CN201110386945.8A 2011-11-29 2011-11-29 ANTLR (Another Tool for Language Recognition)-based importing method for LDF (Log Data File) of description file of LIN (Local Interconnect Network) Expired - Fee Related CN102521291B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110386945.8A CN102521291B (en) 2011-11-29 2011-11-29 ANTLR (Another Tool for Language Recognition)-based importing method for LDF (Log Data File) of description file of LIN (Local Interconnect Network)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110386945.8A CN102521291B (en) 2011-11-29 2011-11-29 ANTLR (Another Tool for Language Recognition)-based importing method for LDF (Log Data File) of description file of LIN (Local Interconnect Network)

Publications (2)

Publication Number Publication Date
CN102521291A CN102521291A (en) 2012-06-27
CN102521291B true CN102521291B (en) 2014-02-19

Family

ID=46292212

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110386945.8A Expired - Fee Related CN102521291B (en) 2011-11-29 2011-11-29 ANTLR (Another Tool for Language Recognition)-based importing method for LDF (Log Data File) of description file of LIN (Local Interconnect Network)

Country Status (1)

Country Link
CN (1) CN102521291B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104281096B (en) * 2013-07-08 2017-10-13 广州中国科学院先进技术研究所 The building method of NC code compiler
CN107862081B (en) * 2017-11-29 2021-07-16 四川无声信息技术有限公司 Network information source searching method and device and server
CN115664980B (en) * 2022-12-09 2023-03-31 长沙科梁科技有限公司 Simulation model generation method, simulation method, storage medium, and terminal device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101612921A (en) * 2009-07-27 2009-12-30 浙江吉利汽车研究院有限公司 A kind of vehicle bus network system
CN102009627A (en) * 2010-11-25 2011-04-13 奇瑞汽车股份有限公司 Controller area network (CAN) and local interconnect network (LIN) bus-based vehicular network communication system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101612921A (en) * 2009-07-27 2009-12-30 浙江吉利汽车研究院有限公司 A kind of vehicle bus network system
CN102009627A (en) * 2010-11-25 2011-04-13 奇瑞汽车股份有限公司 Controller area network (CAN) and local interconnect network (LIN) bus-based vehicular network communication system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
基于ANTLR的NC代码编译器的设计与实现;禹丹等;《计算机应用》;20080228;第28卷(第2期);522-524,527 *
禹丹等.基于ANTLR的NC代码编译器的设计与实现.《计算机应用》.2008,第28卷(第2期),522-524,527.
陈元.基于轿车车身控制网络的研究和仿真.《武汉理工大学硕士学位论文》.2009,22-23. *

Also Published As

Publication number Publication date
CN102521291A (en) 2012-06-27

Similar Documents

Publication Publication Date Title
US9418241B2 (en) Unified platform for big data processing
CN103853650A (en) Test case generating method and device for fuzz testing
CN105512105A (en) Semantic parsing method and device
CN106383701A (en) Common multi-protocol data access interface technology-based data service system
CN102521291B (en) ANTLR (Another Tool for Language Recognition)-based importing method for LDF (Log Data File) of description file of LIN (Local Interconnect Network)
CN103425585A (en) OSGI (Open Service Gateway Initiative) integration testing method
US20190237071A1 (en) Voice recognition method, device and server
CN102147726B (en) Script-based method for implementing service configuration
CN103594085A (en) Method and system providing speech recognition result
CN103677821A (en) Method and device for publishing software development tool code
CN102955740A (en) Driving function and stub function generating method based on Perl
CN111312230A (en) Voice interaction monitoring method and device for voice conversation platform
CN103095726A (en) Processing method and device of protocol interpreter
CN103780624A (en) General application layer network communication protocol application method for complicated system
CN103092866A (en) Data monitoring method and monitoring device
CN103200203B (en) Based on the semantic class protocol format estimating method performing track
CN102236573A (en) Name binding extensibility for typed programming language
CN103593277A (en) Log processing method and system
CN101930362B (en) Method for integrating TTCN language and data description language
CN103440197B (en) A kind of method automatically generating difference test report based on contrast test
WO2016086640A1 (en) Tour inspection report generation method and apparatus
US20100023922A1 (en) Linking uml activity diagram nodes to uml class diagram nodes by using properties from applied stereotypes
CN103336706A (en) System and method for converting pseudocode into programming language
CN102541830B (en) Method and device for generating simulation report in simulation platform
CN101807147B (en) Method for automatically abstracting software architecture from embedded software code

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C53 Correction of patent of invention or patent application
CB03 Change of inventor or designer information

Inventor after: Li Hong

Inventor after: Yang Guoqing

Inventor after: Sun Zheng

Inventor after: Zhong Xiaofeng

Inventor after: Geng Lili

Inventor after: Zhao Minde

Inventor after: Wu Chaohui

Inventor before: Li Hong

Inventor before: Yang Guoqing

Inventor before: Sun Zheng

Inventor before: Zhong Xiaofeng

Inventor before: Geng Lili

Inventor before: Zhao Minde

COR Change of bibliographic data

Free format text: CORRECT: INVENTOR; FROM: LI HONG YANG GUOQING SUN ZHENG ZHONG XIAOFENG GENG LILI ZHAO MINDE TO: LI HONG YANG GUOQING SUN ZHENG ZHONG XIAOFENG GENG LILI ZHAO MINDE WU ZHAOHUI

C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20140219

Termination date: 20211129

CF01 Termination of patent right due to non-payment of annual fee