Smart card script definition and analysis execution method, device and equipment

By defining simple and general script syntax and parsing execution strategies, the complexity problem caused by smart card testing and production scripts due to manufacturer differences is solved, and the infinite scalability and cross-platform migration of script functions is achieved, which simplifies the parser design and improves the Reusability of project results and unified script data.

CN118939266APending Publication Date: 2024-11-12SICHUAN JINGKING WEIDA SMART TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410950290.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

Smart card testing and production scripts are highly complex due to manufacturer differences and complex parsing executors, which requires a lot of human and material resources to process the test and production links. Test scripts are usually not directly applied to the production links, and production scripts need to be redefined and written.

Method used

Define a simple and general script syntax, including annotation syntax, command syntax, variable syntax and method syntax, and implement corresponding parsing and execution strategies, simplify script parser design, support dynamic command and method expansion, and is suitable for testing and production environments.

Benefits of technology

It realizes infinite scalability of script functions, simplifies the implementation of script parser, reduces complexity, supports rapid porting on different platforms, meets the needs of R&D and production, and improves the reusability of project results and script materials. Unification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939266A_ABST
    Figure CN118939266A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field related to programming, in particular to a smart card script definition and analysis execution method, device and equipment. The method comprises the steps that script grammar is determined, and the script grammar comprises annotation grammar, command grammar, variable grammar and method grammar; the annotation grammar starts from a first symbol identifier and ends at the tail of the line; the command grammar is marked by a second symbol to start, and a command name and a command parameter list separated by a comma are followed subsequently; variable grammar is marked by a third symbol to start and a space ends; the method grammar is marked by a fourth symbol, and a method name and parameters are closely followed; writing a smart card script based on the script grammar; and analyzing and executing the intelligent card script based on an analysis execution strategy matched with the script grammar.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field related to programming, and in particular to a method, device and equipment for defining and parsing and executing smart card scripts. Background Art

[0002] Currently, many manufacturers are developing their own smart card test suites, which generally include scripts and tools. The test scripts provided by different manufacturers are different, and the test tools used to execute the test scripts are also completely different.

[0003] After the smart card product is tested, it will be transferred to production. The production phase will also use production scripts and production tools. Due to the environmental constraints of the production tools, these scripts often need to be rewritten. Moreover, similar to the situation in the testing phase, the production scripts and production tools used by different manufacturers are also different.

[0004] After extensive observation and analysis, we found that the scripts provided by these manufacturers are different, and the test tools used to execute the scripts are also completely different. In addition, the smart card test scripts defined by many manufacturers are relatively complex, which leads to complex parsing executors. Another common phenomenon is that due to the characteristics of the production machines, the production scripts and test scripts of the same manufacturer are often inconsistent, because the production process requires simple scripts, convenient operation, and high execution performance. This means that test scripts cannot usually be directly applied to the production process, and production scripts need to be redefined and rewritten.

[0005] Based on the above points, the testing and production stages of smart card related projects require a lot of manpower and material resources to deal with the problems caused by different manufacturers. Summary of the invention

[0006] In view of this, the embodiments of the present application are directed to providing a smart card script definition and parsing execution method, apparatus and device.

[0007] The first aspect of the present application provides a smart card script definition and parsing execution method, comprising: determining a script syntax: wherein the script syntax comprises: comment syntax, command syntax, variable syntax, and method syntax; the comment syntax begins with a first symbol and ends at the end of a line; the command syntax begins with a second symbol, followed by a command name and a comma-separated command parameter list; the variable syntax begins with a third symbol and ends with a space; the method syntax begins with a fourth symbol, followed by a method name and parameters;

[0008] Writing a smart card script based on the script grammar;

[0009] The smart card script is parsed and executed based on a parsing and execution strategy that matches the script syntax.

[0010] In some embodiments, parsing and executing the smart card script based on a parsing execution strategy matching the script grammar includes:

[0011] Read an unread line from the smart card script as the target line;

[0012] Remove the leading and trailing spaces of the target line;

[0013] If the target line is empty, re-execute the read from smart card script for a line that was not read;

[0014] If the target line is an error line, re-execute the line that was not read from the smart card script;

[0015] If the target line is a comment line, then re-execute the unread line from the smart card script; if the target line starts with the second symbol, indicating a command, then further call the command parsing process to parse the command name and parameters;

[0016] After successful processing, the object parsed by the command parsing process is saved in the script object, and the unread line from the smart card script is read again.

[0017] In some embodiments, the command parsing process includes:

[0018] Parse the command name and the corresponding parameter list;

[0019] Use the parameter parsing method to parse each parameter in the parameter list in turn to get the parameter object;

[0020] Save the parameters object into the command object.

[0021] In some embodiments, the parsing and executing the smart card script based on the parsing execution strategy matching the script syntax includes: calling a method parsing process to parse method syntax;

[0022] Among them, the calling method parsing process parses the method syntax, including:

[0023] Parse the method name and the corresponding parameter list;

[0024] Use the parameter parsing method to parse each parameter in the parameter list in turn and output the parameter object;

[0025] Save the parameters object to the method object.

[0026] In some embodiments, the parameter parsing method includes:

[0027] Extract a substring from the parameter list in order for processing; where a single parameter consists of a series of substrings separated by spaces;

[0028] If the substring begins with the third symbol, indicating a variable, the variable is further parsed to obtain the variable name; after successful processing, a variable object is constructed;

[0029] If the substring begins with the fourth symbol, indicating a method, the method name and parameters are further parsed using the method parsing process; after successful processing, the returned method object is saved to the parameter object;

[0030] If the substring does not begin with the fourth symbol identifier and does not begin with the third symbol identifier, the substring is processed according to the string, a string object is constructed, and the string object is saved after the parameter object;

[0031] Finally, the processing results of all substrings are concatenated into a string and returned as the result.

[0032] In some embodiments, the object comprises:

[0033] The script object contains a command list consisting of command objects;

[0034] Command object, which contains a command name and a list of parameter objects;

[0035] Parameter object, which contains a list of string objects, variable objects, and method objects;

[0036] A string object, containing a string;

[0037] A variable object, containing a variable name;

[0038] A method object contains a method name and a list of parameter objects.

[0039] In some embodiments, the first symbol identifier includes: #;

[0040] The second symbol identification includes: *;

[0041] The third symbol identifier includes: $;

[0042] The fourth symbol identification includes: ^.

[0043] In some embodiments, the parameter parsing method includes: saving variable information during the operation process based on a defined operation context;

[0044] Preset an execution method for each object;

[0045] The execution method corresponding to the script object includes: calling the execution method of the command object in sequence;

[0046] The execution method corresponding to the command object includes calling the execution method corresponding to each parameter object in turn to obtain the parameter list; using the reflection mechanism or the hash mechanism to find the corresponding command implementation interface according to the command name, calling its execution method, passing in the corresponding parameter list, and obtaining the processed value; returning the command value;

[0047] The execution process corresponding to the parameter object includes: calling the execution method of each mixed object contained in the parameter in turn to obtain the processed value; connecting the above multiple values ​​together as the return value;

[0048] The execution flow corresponding to the string object includes: returning a string;

[0049] The execution process corresponding to the variable object includes: obtaining the variable value from the running context; returning the variable name and variable value;

[0050] The execution process corresponding to the method object includes: calling the run method of each parameter object in turn to obtain the parameter list; using the reflection mechanism or the hash mechanism to find the corresponding method implementation interface according to the method name, calling its run method, passing in the corresponding parameter list, and obtaining the processed value; returning the value of the method.

[0051] A second aspect of the present application provides a smart card script definition and parsing execution device comprising:

[0052] A writing module is used to determine the script syntax: wherein the script syntax includes: comment syntax, command syntax, variable syntax, and method syntax; the comment syntax starts with a first symbol and ends at the end of the line; the command syntax starts with a second symbol, followed by a command name and a comma-separated list of command parameters; the variable syntax starts with a third symbol and ends with a space; the method syntax starts with a fourth symbol, followed by a method name and parameters; write a smart card script based on the script syntax;

[0053] The parsing module is used to parse and execute the smart card script based on a parsing execution strategy that matches the script syntax.

[0054] A third aspect of the present application provides an electronic device, including:

[0055] A processor, and a memory for storing a program executable by the processor;

[0056] The processor is used to implement the smart card script definition and parsing execution method provided in any of the above embodiments by running the program in the memory.

[0057] A fourth aspect of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor executes the smart card script definition and parsing execution method provided in any of the above embodiments.

[0058] The present application provides a smart card script definition and parsing execution method, first, determine the script syntax: wherein the script syntax includes: comment syntax, command syntax, variable syntax, method syntax; comment syntax starts with the first symbol and ends at the end of the line; command syntax starts with the second symbol, followed by the command name and a comma-separated command parameter list; variable syntax starts with the third symbol and ends with a space; method syntax starts with the fourth symbol, followed by the method name and parameters; write a smart card script based on the script syntax; parse and execute the smart card script based on the parsing execution strategy matching the script syntax. In this way, the scheme provided by the present application uses a simple and universal script syntax, which is easy for users to understand and use. Secondly, the simplicity of the syntax can greatly reduce the complexity of the parser implementation. Thirdly, the bottom layer of the factory's production machine is generally implemented in C++, while the test tool environment and production management system are mostly implemented in JAVA. Therefore, a simple parser can be quickly transplanted in both JAVA and C++ implementations. In this way, the simple and convenient (grammar) script plus the (parser) tool not only meets the needs of R&D testing, but also meets the factory production requirements, realizes the close connection between the two links, improves the reusability of project results in each link, and achieves the unification of script data in the R&D and production departments. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] By describing the embodiments of the present application in more detail in conjunction with the accompanying drawings, the above and other purposes, features and advantages of the present application will become more apparent. The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the accompanying drawings, the same reference numerals generally represent the same components or steps.

[0060] Figure 1 It is a flowchart of a smart card script definition and parsing execution method provided by an embodiment of the present application.

[0061] Figure 2 It is a basic flowchart of script parsing provided by an embodiment of the present application.

[0062] Figure 3 This is a basic flow chart of command parsing provided by an embodiment of the present application.

[0063] Figure 4It is a schematic diagram of a method analysis flow provided in an embodiment of the present application.

[0064] Figure 5 It is a schematic diagram of a parameter parsing process provided by an embodiment of the present application.

[0065] Figure 6 It is a structural diagram of a smart card script definition and parsing execution device provided by an embodiment of the present application.

[0066] Figure 7 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0067] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0068] Application Overview

[0069] Currently, many manufacturers are developing their own smart card test suites, which generally include scripts and tools. The test scripts provided by different manufacturers are different, and the test tools used to execute the test scripts are also completely different.

[0070] After the smart card product is tested, it will be transferred to production. The production phase will also use production scripts and production tools. Due to the environmental constraints of the production tools, these scripts often need to be rewritten. Moreover, similar to the situation in the testing phase, the production scripts and production tools used by different manufacturers are also different.

[0071] After extensive observation and analysis, we found that the scripts provided by these manufacturers are different, and the test tools used to execute the scripts are also completely different. In addition, the smart card test scripts defined by many manufacturers are relatively complex, which leads to complex parsing executors. Another common phenomenon is that due to the characteristics of the production machines, the production scripts and test scripts of the same manufacturer are often inconsistent, because the production process requires simple scripts, convenient operation, and high execution performance. This means that test scripts cannot usually be directly applied to the production process, and production scripts need to be redefined and rewritten.

[0072] Based on the above points, the testing and production stages of smart card related projects require a lot of manpower and material resources to deal with the problems caused by different manufacturers.

[0073] In order to solve the above problems, the present application provides a solution, which defines a simple and universal script grammar and implements a simple and fast grammar parser, which meets the requirements of production and testing, and is used in the testing and production of the company's smart card projects.

[0074] In the smart card project, project members can write various scripts according to the grammar defined in this invention, such as functional test scripts, performance test scripts, card making scripts, card verification scripts, etc. The corresponding syntax parsers can be integrated into the test tools and production tools as modules. Testers can use these scripts to verify the functions, performance, stability and compatibility of smart cards on the test tools, and repeatedly test and confirm the research and development results. After the test is completed, these scripts can be directly provided to the production department and executed by the production personnel on the production tools, so as to complete the production and verification of smart card products conveniently and quickly.

[0075] In this way, everyone no longer needs to be familiar with multiple sets of syntax, the same function does not need to be scripted multiple times, and there is no need to write test scripts and production scripts separately, which greatly reduces the workload related to scripts and effectively avoids errors caused by differences during script conversion. The simple syntax defined in the present invention includes 4 syntaxes: comment syntax, command syntax, variable syntax, and method syntax. The comment syntax starts with #1 and ends at the end of the line; the command syntax starts with *2, followed by the command name and a list of command parameters separated by commas; the variable syntax starts with $ and ends with a space; the method syntax starts with ^, followed by the method name and parameters marked with "(" and ")".

[0076] Since there are only four types of grammars and the grammar is simple enough, the design of the grammar parser is relatively simple and the amount of code is also small.

[0077] Although the grammar defined in the present invention is simple, it supports dynamic commands and methods, which can be infinitely expanded, so that the script function has infinite extensibility. For example, assignment command, APDU sending command, authentication command, label definition command, branch command, etc. Through the combination of these different commands, any script function can be realized. Since these commands all maintain their independence, it is also very easy to implement on different platforms.

[0078] After introducing the basic principles of the present application, various non-limiting embodiments of the present application will be described in detail with reference to the accompanying drawings.

[0079] Exemplary Methods

[0080] Figure 1 FIG. 1 is a flow chart of a smart card script definition and parsing execution method provided by an embodiment of the present application. Figure 1 As shown, the method includes the following contents.

[0081] S101, determining the script syntax: wherein the script syntax includes: comment syntax, command syntax, variable syntax, and method syntax; the comment syntax begins with a first symbol and ends at the end of a line; the command syntax begins with a second symbol, followed by a command name and a comma-separated list of command parameters; the variable syntax begins with a third symbol and ends with a space; the method syntax begins with a fourth symbol, followed by a method name and parameters;

[0082] S102, writing a smart card script based on the script grammar;

[0083] S103, parsing and executing the smart card script based on a parsing and execution strategy that matches the script syntax.

[0084] The grammar defined in the present invention is simple, and dynamic commands and methods are supported. The commands and methods can be infinitely expanded, so that the script function has infinite extensibility. For example, assignment commands, APDU sending commands, authentication commands, label definition commands, branch commands, etc. Through the combination of these different commands, any script function can be realized. Since these commands all maintain their independence, it is also very easy to implement on different platforms.

[0085] In some embodiments, the first symbol identifier may include: #; the second symbol identifier may include: *; the third symbol identifier may include: $; and the fourth symbol identifier may include: ^.

[0086] Specifically, the script syntax is defined as follows:

[0087] A script consists of commands, one command per line.

[0088] The command starts with "*", and the format is: *+command name+space+parameter+comma+parameter+comma+parameter...

[0089] There can be any number of parameters, separated by commas "," .

[0090] Arguments may contain spaces, which are automatically recognized as delimiters or ignored by the parser.

[0091] Example: *send 003A000008112233445566770D,9000

[0092] Scripts can define variables:

[0093] Variables start with "$" and the format is: $+variable name+space

[0094] Variables are used in parameters.

[0095] Example: $tmpStr1

[0096] A script can define methods:

[0097] The method starts with "^" and the format is: ^+method name+(parameter+comma+parameter...)

[0098] There can be 0 or more parameters, separated by commas.

[0099] Methods are used in parameters.

[0100] Example: ^getLength(11223344,02)

[0101] Scripts can define comments:

[0102] Comments start with a "#" sign and the format is: #+comment content

[0103] Comments range from # to the end of the line

[0104] Example: #aaaaaa

[0105] Specifically, the script consists of lines of commands. Each command starts with "*". Command parameters are separated by "," and the parameters can contain variables and / or methods.

[0106] A script can define variables, which start with "$".

[0107] A script can define methods. A method starts with “^” and method parameters are separated by “,”. The parameters can contain variables and / or methods.

[0108] A script can define comments, which start with "#".

[0109] With this setting, by defining multiple commands, providing multiple methods, and combining variable formats and comment formats, this set of grammar can already meet most script requirements, and the grammar parser can also be designed to be simple enough to achieve the goal of fast and stable execution.

[0110] In some embodiments, parsing and executing the smart card script based on the parsing execution strategy matching the script grammar includes:

[0111] Read a line from the smart card script that was not read as the target line

[0112] Remove the leading and trailing spaces of the target line;

[0113] If the target line is empty, re-execute the read from smart card script for a line that was not read;

[0114] If the target line is an error line, re-execute the line that was not read from the smart card script;

[0115] The error line is the line that starts with an undefined character.

[0116] If the target line is a comment line, re-execute the line that was not read from the smart card script;

[0117] If the target line starts with the second symbol, indicating a command, the command parsing process is further called to parse the command name and parameters;

[0118] After successful processing, the object parsed by the command parsing process is saved in the script object, and the unread line from the smart card script is read again.

[0119] Specifically, in some embodiments, the object includes:

[0120] The script object contains a command list consisting of command objects;

[0121] Command object, which contains a command name and a list of parameter objects;

[0122] Parameter object, which contains a list of string objects, variable objects, and method objects;

[0123] A string object, containing a string;

[0124] A variable object, containing a variable name;

[0125] A method object contains a method name and a list of parameter objects.

[0126] Reference Figure 2 , the basic process of script parsing is as follows:

[0127] The system first reads a line from the script file.

[0128] If the file is read, the script parsing is finished. Otherwise, continue to the next step.

[0129] Remove leading and trailing spaces from the lines read.

[0130] If the row is empty, skip to step 1.

[0131] If the line starts with #, it indicates a comment and no further processing is performed, skipping to the first step.

[0132] If the line starts with *, it indicates a command, and the command parsing process is further called to parse the command name and parameters.

[0133] After successful processing, the object parsed by the command parsing process is saved in the script object, and the first step is skipped to continue parsing the next command.

[0134] If a processing error occurs, an error prompt will be given and script parsing will end.

[0135] If the line starts with other characters, a syntax error is displayed and script parsing ends.

[0136] In some embodiments, the command parsing process includes:

[0137] Parse the command name and the corresponding parameter list;

[0138] Use the parameter parsing method to parse each parameter in the parameter list in turn to get the parameter object;

[0139] Save the parameters object into the command object.

[0140] Specifically, refer to Figure 3 , the basic process of command parsing is as follows:

[0141] Parse out the command name and a comma-separated list of arguments;

[0142] Use the parameter parsing method to parse each parameter in turn to get the parameter object;

[0143] Save the parameter object into the command object;

[0144] After parsing is completed, the command object is returned;

[0145] In some embodiments, parsing and executing the smart card script based on a parsing execution strategy matching the script grammar includes:

[0146] Call method parsing process to parse method syntax;

[0147] Among them, the calling method parsing process parses the method syntax, including:

[0148] Parse the method name and the corresponding parameter list;

[0149] Use the parameter parsing method to parse each parameter in the parameter list in turn and output the parameter object;

[0150] Save the parameters object to the method object.

[0151] Specifically, refer to Figure 4 , the basic process of method parsing is as follows:

[0152] Parse out the method name and comma-separated parameter list;

[0153] Use the parameter parsing method to parse each parameter in turn and output the parameter object;

[0154] Save the parameter object to the method object;

[0155] The processing is completed and the method object is returned;

[0156] In some embodiments, the parameter parsing method includes:

[0157] Extract a substring from the parameter list in order for processing; where a single parameter consists of a series of substrings separated by spaces;

[0158] If the substring begins with the third symbol, indicating a variable, the variable is further parsed to obtain the variable name; after successful processing, a variable object is constructed;

[0159] If the substring begins with the fourth symbol, indicating a method, the method name and parameters are further parsed using the method parsing process; after successful processing, the returned method object is saved to the parameter object;

[0160] If the substring does not begin with the fourth symbol identifier and does not begin with the third symbol identifier, the substring is processed according to the string, a string object is constructed, and the string object is saved after the parameter object;

[0161] Finally, the processing results of all substrings are concatenated into a string and returned as the result.

[0162] Specifically, refer to Figure 5 , the basic process of single parameter parsing (command or method) is as follows:

[0163] A single parameter consists of a series of substrings separated by spaces. The system extracts a substring from the parameter in sequence for processing.

[0164] If all substrings have been processed, parameter processing is complete. Otherwise, proceed to the next step.

[0165] If the substring starts with $, it indicates a variable, then the variable is further parsed to get the variable name

[0166] After successful processing, construct the variable object, save it to the parameter object, and then jump to the first step.

[0167] If an error is handled, an error prompt will be given and the script parsing is completed.

[0168] If the substring starts with ^, it indicates a method, and the method resolution process further resolves the method name and parameters.

[0169] After successful processing, save the returned method object to the parameter object and jump to the first step.

[0170] If an error is handled, an error prompt will be given and the script parsing is completed.

[0171] Otherwise, process the string as is, construct a string object, save the string object to the parameter object, and then jump to the first step.

[0172] Finally, the processing results of all substrings are concatenated into a string and returned as the result.

[0173] Specifically, to sum up, the system includes the following objects:

[0174] Script object: contains a command list consisting of command objects

[0175] Command object: contains a command name and a list of parameter objects

[0176] Parameter object: contains a list of string objects, variable objects, and method objects.

[0177] String object: contains a string

[0178] Variable object: contains a variable name

[0179] Method object: contains a method name and a list of parameter objects

[0180] The present invention also defines a script execution process, and each object implements an execution method run. The running process of the run method is also the execution process of the object. The execution process also defines a running context for storing variable information during the running process.

[0181] The system includes the following object execution processes:

[0182] Script object execution process: call the run method of the command object in sequence.

[0183] Command object execution process:

[0184] Call the run method of each parameter object in turn to obtain the parameter list;

[0185] Use the reflection mechanism or Hash mechanism to find the corresponding command implementation interface according to the command name, call its run method, pass in the corresponding parameter list, and obtain the processed value.

[0186] Returns the value of a command.

[0187] Parameter object execution process:

[0188] Call the run method of each mixed object contained in the parameter in turn to obtain the processed value.

[0189] Concatenate the above multiple values ​​together as the return value.

[0190] String object execution flow: returns a string.

[0191] Variable object execution process:

[0192] Get the value of a variable from the execution context.

[0193] Returns the variable name and value.

[0194] Method object execution process:

[0195] Call the run method of each parameter object in turn to obtain the parameter list;

[0196] Use the reflection mechanism or Hash mechanism to find the corresponding method implementation interface according to the method name, call its run method, pass in the corresponding parameter list, and obtain the processed value.

[0197] Returns the value of a method.

[0198] The entire script execution process is to first parse the script, obtain the script object and its associated objects, and then call the run method of each object step by step.

[0199] In the solution provided by the present application, firstly, the simple and universal script syntax is easy for users to understand and use. Secondly, the simplicity of the syntax can greatly reduce the complexity of the parser implementation. Thirdly, the bottom layer of the factory's production machine is generally implemented in C++, while the test tool environment and production management system are mostly implemented in JAVA. Therefore, a simple parser can be quickly transplanted in both JAVA and C++ implementations.

[0200] In this way, the simple and convenient (grammar) script plus the (parser) tool not only meets the needs of R&D testing, but also meets the factory production requirements, realizes the close connection between the two links, improves the reusability of project results in each link, and achieves the unification of script data in the R&D and production departments.

[0201] Exemplary Devices

[0202] The device embodiments of the present application can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0203] Figure 6 FIG. 1 is a block diagram of a smart card script definition and parsing execution device provided by an embodiment of the present application. Figure 6 As shown, the smart card script definition and parsing execution device includes:

[0204] A writing module 61 is used to determine the script syntax: wherein the script syntax includes: comment syntax, command syntax, variable syntax, and method syntax; the comment syntax starts with a first symbol and ends at the end of a line; the command syntax starts with a second symbol, followed by a command name and a comma-separated list of command parameters; the variable syntax starts with a third symbol and ends with a space; the method syntax starts with a fourth symbol, followed by a method name and parameters; write a smart card script based on the script syntax;

[0205] The parsing module 62 is used to parse and execute the smart card script based on a parsing execution strategy that matches the script syntax.

[0206] Exemplary Electronic Devices

[0207] Below, reference Figure 7 To describe an electronic device according to an embodiment of the present application. Figure 7 A block diagram of an electronic device according to an embodiment of the present application is illustrated.

[0208] like Figure 7 As shown, electronic device 700 includes one or more processors 710 and memory 720 .

[0209] The processor 710 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 700 to perform desired functions.

[0210] The memory 720 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 710 may run the program instructions to implement the smart card script definition and parsing execution method of each embodiment of the present application described above and / or other desired functions. Various contents such as category correspondences may also be stored in the computer-readable storage medium.

[0211] In one example, the electronic device 700 may further include: an input device 730 and an output device 740 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0212] In addition, the input device 730 may also include, for example, a keyboard, a mouse, an interface, etc. The output device 740 may output various information to the outside, including analysis results, etc. The output device 740 may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, etc.

[0213] Of course, to simplify, Figure 7 Only some of the components in the electronic device related to the present application are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, the electronic device may further include any other appropriate components according to specific application conditions.

[0214] Exemplary computer program products and computer-readable storage media

[0215] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the smart card script definition and parsing execution method according to various embodiments of the present application described in the above-mentioned "Exemplary Method" section of this specification.

[0216] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0217] In addition, an embodiment of the present application may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, enables the processor to execute the steps of the smart card script definition and parsing execution method according to various embodiments of the present application described in the above “Exemplary Method” section of this specification.

[0218] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0219] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present application to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

Claims

1. A smart card script definition and parsing execution method, characterized in that: include: Determine the script syntax: wherein the script syntax includes: comment syntax, command syntax, variable syntax, and method syntax; the comment syntax begins with a first symbol and ends at the end of a line; the command syntax begins with a second symbol, followed by a command name and a comma-separated list of command parameters; The variable syntax starts with the third symbol and ends with a space; the method syntax starts with the fourth symbol, followed by the method name and parameters; Writing a smart card script based on the script grammar; The smart card script is parsed and executed based on a parsing and execution strategy that matches the script syntax.

2. The smart card script definition and parsing execution method according to claim 1, characterized in that: The parsing and executing of the smart card script based on the parsing execution strategy matching the script grammar includes: Read an unread line from the smart card script as the target line; Remove the leading and trailing spaces of the target line; If the target line is empty, re-execute the read from smart card script for a line that was not read; If the target line is an error line, re-execute the line that was not read from the smart card script; If the target line is a comment line, re-execute the line that was not read from the smart card script; If the target line starts with the second symbol, indicating a command, the command parsing process is further called to parse the command name and parameters; after successful processing, the object parsed by the command parsing process is saved in the script object, and the unread line from the smart card script is re-executed.

3. The smart card script definition and parsing execution method according to claim 2, characterized in that: The command parsing process includes: Parse the command name and the corresponding parameter list; Use the parameter parsing method to parse each parameter in the parameter list in turn to get the parameter object; Save the parameters object into the command object.

4. The smart card script definition and parsing execution method according to claim 2, characterized in that: The parsing and executing of the smart card script based on the parsing execution strategy matching the script syntax includes: calling a method parsing process to parse method syntax; Among them, the calling method parsing process parses the method syntax, including: Parse the method name and the corresponding parameter list; Use the parameter parsing method to parse each parameter in the parameter list in turn and output the parameter object; Save the parameters object to the method object.

5. The smart card script definition and parsing execution method according to claim 3 or 4, characterized in that: The parameter parsing method comprises: Extract a substring from the parameter list in order for processing; where a single parameter consists of a series of substrings separated by spaces; If the substring begins with the third symbol, indicating a variable, the variable is further parsed to obtain the variable name; after successful processing, a variable object is constructed; If the substring begins with the fourth symbol, indicating a method, the method name and parameters are further parsed using the method parsing process; after successful processing, the returned method object is saved to the parameter object; If the substring does not begin with the fourth symbol identifier and does not begin with the third symbol identifier, the substring is processed according to the string, a string object is constructed, and the string object is saved after the parameter object; Finally, the processing results of all substrings are concatenated into a string and returned as the result.

6. The smart card script definition and parsing execution method according to claim 2, characterized in that: The objects include: The script object contains a command list consisting of command objects; Command object, which contains a command name and a list of parameter objects; Parameter object, which contains a list of string objects, variable objects, and method objects; A string object, containing a string; A variable object, containing a variable name; A method object contains a method name and a list of parameter objects.

7. The smart card script definition and parsing execution method according to claim 2, characterized in that: The first symbol identification includes: #; The second symbol identification includes: *; The third symbol identifier includes: $; The fourth symbol identification includes: ^.

8. The smart card script definition and parsing execution method according to claim 6, characterized in that: Also includes: Based on the defined running context, save the variable information during the running process; Preset an execution method for each object; The execution method corresponding to the script object includes: calling the execution method of the command object in sequence; The execution method corresponding to the command object includes calling the execution method corresponding to each parameter object in turn to obtain the parameter list; using the reflection mechanism or the hash mechanism to find the corresponding command implementation interface according to the command name, calling its execution method, passing in the corresponding parameter list, and obtaining the processed value; returning the command value; The execution process corresponding to the parameter object includes: calling the execution method of each mixed object contained in the parameter in turn to obtain the processed value; connecting the processed values ​​together as the return value; The execution flow corresponding to the string object includes: returning a string; The execution process corresponding to the variable object includes: obtaining the variable value from the running context; returning the variable name and variable value; The execution process corresponding to the method object includes: calling the run method of each parameter object in turn to obtain the parameter list; using the reflection mechanism or the hash mechanism to find the corresponding method implementation interface according to the method name, calling its run method, passing in the corresponding parameter list, and obtaining the processed value; returning the value of the method.

9. A smart card script definition and parsing execution device, characterized in that: include: A writing module is used to determine the script syntax: wherein the script syntax includes: comment syntax, command syntax, variable syntax, and method syntax; the comment syntax starts with a first symbol and ends at the end of the line; the command syntax starts with a second symbol, followed by a command name and a comma-separated list of command parameters; the variable syntax starts with a third symbol and ends with a space; the method syntax starts with a fourth symbol, followed by a method name and parameters; write a smart card script based on the script syntax; The parsing module is used to parse and execute the smart card script based on a parsing execution strategy that matches the script syntax.

10. An electronic device, characterized in that: include: A processor, and a memory for storing a program executable by the processor; The processor is used to implement the smart card script definition and parsing execution method according to any one of claims 1 to 8 by running the program in the memory.