CN102750152B - Method and device of application for generating a plurality of programming languages based on descriptive language - Google Patents

Method and device of application for generating a plurality of programming languages based on descriptive language Download PDF

Info

Publication number
CN102750152B
CN102750152B CN201210212289.4A CN201210212289A CN102750152B CN 102750152 B CN102750152 B CN 102750152B CN 201210212289 A CN201210212289 A CN 201210212289A CN 102750152 B CN102750152 B CN 102750152B
Authority
CN
China
Prior art keywords
template
programming language
file
application
language
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.)
Active
Application number
CN201210212289.4A
Other languages
Chinese (zh)
Other versions
CN102750152A (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.)
Sina Technology China Co Ltd
Original Assignee
Sina Technology China Co Ltd
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 Sina Technology China Co Ltd filed Critical Sina Technology China Co Ltd
Priority to CN201210212289.4A priority Critical patent/CN102750152B/en
Publication of CN102750152A publication Critical patent/CN102750152A/en
Application granted granted Critical
Publication of CN102750152B publication Critical patent/CN102750152B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the invention discloses a method and a device of an application for generating a plurality of programming languages based on a descriptive language. The method comprises the following steps of: obtaining a descriptive language and a predefined descriptive language analysis rule both defined in advance and corresponding to the application; and analyzing the descriptive language by using the descriptive language analysis rule and a dictionary of the plurality of programming languages to obtain the application of the plurality of programming languages. With the method or the device provided by the embodiment of the invention, only the descriptive language and the descriptive language analysis rule need to be defined in advance so that the dictionary of the plurality of programming languages can be utilized to generate the application of the plurality of programming languages; in this way, the time and resources for compiling the application of the plurality of programming languages sevel times are saved; furthermore, the efficiency of generating the application of the plurality of programming languages is also improved.

Description

A kind of method and device generating the application of multiple programming language based on descriptive language
Technical field
The present invention relates to computer software technical field, particularly relate to a kind of method and the device that generate the application of multiple programming language based on descriptive language.
Background technology
Being applied in computer software technical field, generally referring to the application software on software platform, is also the software needing to be supplied to by means of platform user's use, such as, and Android application, website application etc.Generally, need the application that different programming language is provided to same function, a such as API (Application Programming Interface, application programming interface) SDK (the Software Development Kit of multiple programming language is often provided, SDK (Software Development Kit)), and these SDK to be programming language different, function is all the same.Such as cell-phone customer terminal again, if want to allow cell-phone customer terminal in the upper operation of IOS (Apple Macintosh operating system, iPhone Operating System), then needs to use the exploitation of object C programming language; If want again to allow cell-phone customer terminal run in ANDROID (Android) system, then need again to use the exploitation of JAVA programming language once.And the cell-phone customer terminal of these two kinds of different programming languages, function is the same.
Inventor finds in research process, in prior art, for same function, needs repeatedly to develop respectively for different programming language, just can obtain application corresponding to often kind of programming language.This not only makes the application and development cost of multiple programming language large, development time is long, and waste of manpower resource, the more important thing is, because its cost of development is large and the development time is long, also the formation efficiency of the application of multiple programming language can be caused low, the download efficiency of subsequent user when down load application further also can be made low.
Summary of the invention
Technical matters to be solved by this invention is, a kind of method and the device that generate the application of multiple programming language based on descriptive language are provided, large with the application and development cost solved due to multiple programming language in prior art, development time is long, and waste of manpower resource, the formation efficiency of the application of the multiple programming language caused is low, and the technical matters that the download efficiency of subsequent user when down load application is low.
For solving the problems of the technologies described above, embodiments provide a kind of method generating the application of multiple programming language based on descriptive language, the method comprises:
Obtain and predefinedly and described apply corresponding descriptive language and descriptive language resolution rules;
The dictionary of described descriptive language resolution rules and multiple programming language is adopted described descriptive language to be resolved to the application of described multiple programming language.
Preferably, described descriptive language is resolved to the application of described multiple programming language by the dictionary of described employing described descriptive language resolution rules and multiple programming language, specifically comprises:
According to the dictionary of described descriptive language resolution rules and described multiple programming language, described descriptive language is resolved to the data structure with corresponding relation, described in there is corresponding relation data structure correspond to the variable part of described application;
Obtain multiple template compressed packages that described multiple programming language is corresponding, and according to the configuration file in described template compressed package and the described application with the multiple programming language of data structure building of corresponding relation.
Preferably, described in there is corresponding relation data structure be array, then describedly described descriptive language is resolved to the data structure with corresponding relation, specifically comprises:
Predefined descriptive language according to described application generates word list;
By the word in word list described in regular expression identification;
Use the dictionary of described multiple programming language to translate described word and obtain translation result;
By translation result form generation array according to the rules.
Preferably, described according to the configuration file in described template compressed package and the described application with the multiple programming language of data structure building of corresponding relation, specifically comprise:
Obtain the configuration file in current template compressed package and template file, described configuration file represents first deposit position of template file in described current template compressed package, and template file resolves rear second deposit position of program file in described current template compressed package generated;
Described template file is resolved to executable code by the data structure described in foundation with corresponding relation;
Run described executable code to obtain operation result file;
Described operation result file is deposited in described current template compressed package;
Delete the configuration file in described current template compressed package and template file.
Preferably, before the configuration file obtained in current template compressed package and template file, also comprise:
Primary template compressed package is copied to temp directory;
Using the copy under described temp directory as described current template compressed package.
Preferably, described programming language is hypertext pre-service PHP programming language, and described template file adopts the compiling of PHP programming language, then described template file is resolved to executable code by the data structure described in described foundation with corresponding relation, specifically comprises:
PHP label in described template file is replaced with other marks of specifying;
Template label in described template file is replaced with described PHP label;
Described other marks of specifying are replaced with described PHP label.
Preferably, adopting after described descriptive language to resolve to the application of described multiple programming language by the dictionary of described multiple programming language, also comprise:
Receive the download request that client-requested downloads the application of described multiple programming language;
The application of the programming language of correspondence is sent to described client by the programming language used according to described client.
Preferably, described programming language includes but not limited to PHP programming language, JAVA language, C/C++ language, NET language, Ruby language and Python.
The embodiment of the present invention additionally provides a kind of device generating the application of multiple programming language based on descriptive language, comprising:
Acquisition module, predefined and describedly applies corresponding descriptive language and descriptive language resolution rules for obtaining;
Parsing module, for the application adopting the dictionary of described descriptive language resolution rules and multiple programming language described descriptive language to be resolved to described multiple programming language.
Preferably, described parsing module specifically comprises:
First analyzing sub-module, for the dictionary according to described descriptive language resolution rules and described multiple programming language, described descriptive language is resolved to the data structure with corresponding relation, described in there is corresponding relation data structure correspond to the variable part of described application;
Obtain submodule, for obtaining multiple template compressed packages corresponding to described multiple programming language;
Generate application submodule, for according to the configuration file in described template compressed package and the described application with the multiple programming language of data structure building of corresponding relation.
Preferably, described first analyzing sub-module specifically comprises:
Generate word list submodule, generate word list for the predefined descriptive language according to described application;
Recognin module, for by the word in word list described in regular expression identification;
Translation submodule, translates described word for using the dictionary of described multiple programming language and obtains translation result;
Generate array submodule, for by translation result according to the rules form generate array.
Preferably, described generation application submodule specifically comprises:
Obtain file submodule, for obtaining configuration file in current template compressed package and template file, described configuration file represents first deposit position of template file in described current template compressed package, and template file resolves rear second deposit position of program file in described current template compressed package generated;
Second analyzing sub-module, resolves to executable code for the data structure described in foundation with corresponding relation by described template file;
Operation code submodule, for running described executable code to obtain operation result file;
Deposit submodule, for being deposited by described operation result file in described current template compressed package;
Delete submodule, for deleting configuration file in described current template compressed package and template file.
Preferably, described generation application submodule also comprises:
Replicon module, for being copied to temp directory by primary template compressed package;
Determine submodule, for using the copy under described temp directory as described current template compressed package.
Preferably, described second analyzing sub-module specifically comprises:
First replaces submodule, for the PHP label in described template file being replaced with other marks of specifying;
Second replaces submodule, for the template label in described template file is replaced with described PHP label;
3rd replaces submodule, for described other marks of specifying are replaced with described PHP label.
Preferably, also comprise:
Receiving download request module, downloading the download request of the application of described multiple programming language for receiving client-requested;
Sending module, sends to described client for the programming language used according to described client by the application of the programming language of correspondence.
As can be seen from above-mentioned technical scheme, in the embodiment of the present invention in the present embodiment, only need by pre-defined descriptive language and descriptive language resolution rules, the dictionary of multiple programming language just can be utilized to generate the application of multiple programming language, which saves time and the resource of the application of repeatedly writing multiple programming language, thus also can improve the efficiency of the application generating multiple programming language.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present application or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, the accompanying drawing that the following describes is only some embodiments recorded in the application, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the process flow diagram of embodiment of the method 1 of the present invention;
Fig. 2 is the process flow diagram of embodiment of the method 2 of the present invention;
Fig. 3 is the process flow diagram of step 201 in embodiment of the method 2 of the present invention;
Fig. 4 is the process flow diagram of step 203 in embodiment of the method 2 of the present invention;
Fig. 5 is a process flow diagram of step 402 in embodiment of the method 2 of the present invention;
Fig. 6 is another process flow diagram of step 402 in embodiment of the method 2 of the present invention;
Fig. 7 is the process flow diagram of embodiment of the method 3 of the present invention;
Fig. 8 is the structural representation of device embodiment 1 of the present invention;
Fig. 9 is the structural representation of parsing module 802 in device embodiment 1 of the present invention;
Figure 10 is the structural representation of the first analyzing sub-module 901 in device embodiment 1 of the present invention;
Figure 11 is the structural representation generating application submodule 903 in device embodiment 1 of the present invention;
Figure 12 is the structural representation of the second analyzing sub-module 1102 in device embodiment 1 of the present invention;
Figure 13 is another structural representation generating application submodule 903 in device embodiment 1 of the present invention;
Figure 14 is the structural representation of device embodiment 2 of the present invention.
Embodiment
The main thought of the embodiment of the present invention comprises: needs are self-defined a kind of descriptive language first, and defines descriptive language resolution rules, then adopts the dictionary of described multiple programming language described descriptive language to be resolved to the application of described multiple programming language.
The present invention program is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Conveniently those skilled in the art have clearer understanding in detail to the descriptive language in the embodiment of the present invention, first describe in detail to the definition of descriptive language and descriptive language resolution rules below.
Descriptive language in the embodiment of the present invention can be XML (Extensible Markup Language, extend markup language) file, also can be a kind of code snippet having self-defined grammer, and it corresponds to the variable part of application.For application dissimilar in practical application, descriptive language and the descriptive language resolution rules of definition can be different, and those skilled in the art are adaptive to be adjusted.With SDK (Software Development Kit, SDK (Software Development Kit)) class is applied as example, the variable part of a SDK application often has requesting method, required parameter, request URL (Uniform Resource Locator, URL(uniform resource locator)) and request type etc., then requesting method, required parameter, request URL and request type XML file can be represented in embodiments of the present invention.XML file such as follows:
Certainly, also can represent with a kind of code snippet with self-defined grammer in embodiments of the present invention, such as shown below code snippet:
function methodName(paramter1,paramter2)POST http://xxxx{
}
Method name, parameter name, request type and request URL is defined in above-mentioned code snippet.
Show a kind of process flow diagram generating the embodiment of the method 1 of the application of multiple programming language based on descriptive language of the present invention see Fig. 1, Fig. 1, the present embodiment can comprise the following steps:
Step 101: obtain and predefined and describedly apply corresponding descriptive language and descriptive language resolution rules.
In embodiments of the present invention, self-defining descriptive language and descriptive language resolution rules difference, then just may be different to the analytic method of descriptive language.Such as, when descriptive language is XML file, existing DOM (Document Object Model, DOM Document Object Model) method can be adopted to resolve, XML file is resolved to the related data structure of tool, such as array.When descriptive language is self-defining code snippet, the dictionary that the embodiment of the present invention can be utilized to provide is resolved.
It should be noted that, an application often corresponding many files, some file is change, and some file is changeless, and descriptive language can correspond to the variable part of described application.
Step 102: adopt the dictionary of described descriptive language resolution rules and multiple programming language described descriptive language to be resolved to the application of described multiple programming language.
In a step 102, then adopt the dictionary needing the multiple programming language of resolving, and according to described descriptive language resolution rules, descriptive language is directly resolved to the application of described multiple programming language.
In actual applications, this step specifically can comprise:
Sub-step A1: according to the dictionary of described descriptive language resolution rules and described multiple programming language, described descriptive language is resolved to the data structure with corresponding relation, described in there is corresponding relation data structure correspond to the variable part of described application;
Sub-step A2: obtain multiple template compressed packages that described multiple programming language is corresponding, and according to the configuration file in described template compressed package and the described application with the multiple programming language of data structure building of corresponding relation.
Programming language in the embodiment of the present invention includes but not limited to PHP (supertext pre-service language, Hypertext Preprocessor) programming language, JAVA language, C/C++ language .NET language, Ruby language and Python.
In the present embodiment visible, only need by pre-defined descriptive language and descriptive language resolution rules, dictionary just can be utilized to generate the application of multiple programming language, which saves time and the resource of the application of repeatedly writing multiple programming language, thus also can improve the efficiency of the application generating multiple programming language.
Show a kind of process flow diagram generating the embodiment of the method 2 of the application of multiple programming language based on descriptive language of the present invention see Fig. 2, Fig. 2, the present embodiment can comprise the following steps:
Step 201: obtain and predefined and describedly apply corresponding descriptive language and descriptive language resolution rules.
Step 202: according to the dictionary of descriptive language resolution rules and multiple programming language, described descriptive language is resolved to the data structure with corresponding relation, described in there is corresponding relation data structure correspond to the variable part of described application.
In actual applications, described in there is corresponding relation data structure be array, then with reference to shown in figure 3, step 202 specifically can comprise:
Step 301: the predefined descriptive language according to described application generates word list;
In the present example, be that code snippet is illustrated with descriptive language.
First, code snippet can be resolved to word list, this can realize by carrying out code snippet in " read into " operation.Such as, often read a word, just in primary chip segment, delete this word, and a word is increased in word list, each word carries some attributes (as type, operand etc.), after each reading word, the word newly read is added word list, the complete word list that the primary chip segment of final generation is corresponding.
Step 302: by the word in word list described in regular expression identification;
Regular expression identified word can be passed through in actual applications.Such as, a character string is read as follows:
Read a numeral then as follows:
It should be noted that, when the current character of code snippet starts with quotation marks, so next word by reading character, and if code snippet current character be numeral, so next word is by reading numeral.
Be understandable that, code snippet has certain grammer, and regular expression mates successively according to appointment grammer.If run into the word of None-identified in actual applications, grammar mistake can be reported.After code snippet complete solution is analysed, obtain the array of a word list.Such as:
Step 303: use the dictionary of described multiple programming language to translate described word and obtain translation result;
In this step, the dictionary of various programming language is used to translate.Dictionary in the embodiment of the present invention is the pre-set analytic method to word.Often kind of programming language in the embodiment of the present invention is all to there being a dictionary.In actual applications, for each programming language, this step can circulate word list, calls the different analytic method of dictionary, finally resolve to the executable code of this kind of programming language according to word types.Translation process is described in detail below with connector citing.
For different programming languages, the connector of Java programming language represents with "+", and the connector of PHP programming language represents with ". ", and also the connector of some programming language may represent with " & ".In embodiments of the present invention, can " & " represents in code designation fragment is connector, so when carrying out word and resolving, if matched " & " symbol, then can produce a word array (' AND ').When using dictionary translation, if run into word array (' AND '), the result that the dictionary of different programming language translates is by different, and the dictionary translation result of PHP programming language be ". ", and the result that Java programming language is translated is "+".
Step 304: by translation result form generation array according to the rules.
In the present example for array, again by the translation result of word list form generation array according to the rules after translation, be namely will generate the array of prescribed form after having resolved descriptive language.Still be applied as example with SDK, after having resolved descriptive language, will of this sort array as follows be obtained:
Step 203: obtain multiple template compressed packages that described multiple programming language is corresponding.
In embodiments of the present invention, same class application often has code two parts of identical code and change.Example is applied as with SDK class, regardless of which kind of programming language, the mode of its request interface is the same, but required parameter, request URL etc., different SDK is vicissitudinous, then correspondence can adopt template mechanism, is namely the place of change to be used template label (being namely use complicated operation can represent with label in template), to generate the application of multiple programming language after making finally to resolve template.
Because an application often has many files, some file is change, some file is changeless, if so according to the corresponding masterplate file of the file that is changed, so an application has a lot of template files, pending data volume will be made so comparatively large, be also inconvenient to manage masterplate simultaneously.Therefore, the embodiment of the present invention provides a kind of mode using compressed package as template, all template files and changeless file are all placed on (being namely template compressed package) in same compressed package, so just make the just corresponding template compressed package of often kind of programming language in the embodiment of the present invention, pending data volume can be saved, also facilitate administrative template.
Except having template file and except the file that immobilizes, also should having a configuration file in template compressed package in the embodiment of the present invention.This configuration file can the deposit position of pattern of descriptive parts file in template compressed package, and template file resolve after the deposit position of program file in template compressed package that generate.Such as, for the template compressed package of PHP programming language, suppose that its configuration file in template compressed package is the content of config.ini, this config.ini and is:
tpl/filename1.tpl.php=class/filename1.class.php
tpl/filename2.tpl.php=class/filename2.class.php
Then foregoing can represent that " tpl/filename1.tpl.php " is a template file in template compressed package, and the program file that this template file is resolved rear generation is " class/filename1.class.php " in template compressed package.
Step 204: according to the configuration file in described template compressed package and the described application with the multiple programming language of data structure building of corresponding relation.
After getting template compressed package, extract configuration file, template file can be obtained again according to configuration file, the application of multiple programming language can be generated with reference to the aforementioned data structure with corresponding relation in the process of resolving template file, wherein, have in the data structure of corresponding relation and deposit the value of template variable, in the process of resolving template, need the value obtaining template variable from the data structure with corresponding relation.
With reference to figure 4, described step 204 in actual applications, specifically can comprise:
Step 401: obtain the configuration file in current template compressed package and template file, described configuration file represents the deposit position of template file in described current template compressed package, and template file resolves the rear deposit position of program file in described current template compressed package generated;
Because define the template file of template compressed package in configuration file in embodiments of the present invention, which file that configuration file can indicate in template compressed package is template file, and the deposit position of program file in template compressed package after template file parsing, so first extract configuration file to go out template file according to the contents extraction in configuration file again, the technology of various existing compressed package extraction document can be utilized to be extracted from template compressed package by template file when extracting template file.Such as can carry out compressed package files extraction by the ZipArchive class of PHP programming language.
Step 402: described template file is resolved to executable code by the data structure described in foundation with corresponding relation;
After extracting template file, need the content of template file to be carried out replacing to generate executable program code, in embodiments of the present invention, the template label in template file does not need too complicated, can support primary programming language grammer.
Conveniently clearer this step of understanding in detail of those skilled in the art, below with in actual applications, suppose that described programming language is PHP programming language, described template file also adopts PHP programming language to carry out being compiled as example and is described, then with reference to shown in figure 5, described step 402 specifically can comprise:
Step 501: the PHP label in described template file is replaced with other marks of specifying;
Solution problem is needed in the process of replacing template label, such as, the executable program code generated is PHP programming language, and template file is when being also PHP programming language, then template label can not use PHP label " <? php " and "? > " mark, and the PHP code in template file can not be allowed to be performed when parsing.Therefore, first need to replace the PHP label of script in template file, replaced with other marks of specifying.Such as, will " <? php " replace with " #PHP_TAG_BEGIN# ", and will "? > " replace with " #PHP_TAG_END# ".Be understandable that, only need the mark of other being specified, be which type of other mark without the need to limiting, those skilled in the art can adaptive autonomous adjustment.
Step 502: the template label in described template file is replaced with described PHP label;
Secondly also need the template label in template file to replace with PHP label, template label is such as specified to start with " <{ " label, with " } > " label terminates, primary PHP code can be write between these two labels, at this time need first " <{ " to be replaced with " <? php ", again by " } > " replace with "? > ", the PHP code in such template label just can be performed.
Step 503: described other marks of specifying are replaced with described PHP label.
Finally more aforementioned other marks " #PHP_TAG_BEGIN# " of specifying are replaced with " <? php echo " <? php "? > " ", and " #PHP_TAG_END# " mark is replaced with " <? php echo "? > "? > ".
One section of executable program code finally can be obtained afterwards by replacing it of step 501 ~ step 503.
Step 403: run described executable code to obtain operation result file;
Then run the aforementioned executable code obtained and can obtain operation result file, it should be noted that, if result directly can be printed when directly performing executable program code, execution result can not be allowed in actual applications to print, this just needs first to be buffered in internal memory by execution result, and the execution result then in acquisition internal memory is as operation result file.
And identifying code execution result being buffered to the execution result in internal memory and acquisition internal memory is as follows:
Ob_start (); // start one to export buffering.
Eval ('? > '. code); // run executable program code
$ result=ob_get_clean (); Buffered data in // acquisition internal memory.
Step 404: described operation result file is deposited in described current template compressed package;
Operation result file is also needed to put into template compressed package after generating run destination file, the position put in template compressed package configures in configuration file, file can be added by various known technology in template compressed package when implementing, such as, can add file by the ZipArchive class of PHP programming language to template compressed package.
Step 405: delete the configuration file in described current template compressed package and template file.
Finally need to delete file (template file and configuration file etc.) unnecessary in template compressed package, now template compressed package has just become an application can downloaded for user.
It should be noted that, in the specific implementation, because template compressed package needs recycling, directly can not can not modify to masterplate compressed package, so need the copy compressed package first setting up a masterplate compressed package, then copy compressed package be operated.With reference to figure 6, before described step 501, can also comprise the following steps:
Step 601: primary template compressed package is copied to temp directory;
Needing the temp directory that copy original stencil compressed package is specified in this step, for distinguishing with original stencil compressed package, the masterplate compressed package copying temp directory to can be called " copy compressed package ".
Step 602: using the copy compressed package under described temp directory as described current template compressed package.
And then using the copy compressed package under temp directory as described current template compressed package, then follow-up for template compressed package be exactly copy compressed package, thus can not need directly to revise original template compressed package.
In the present embodiment, only need by pre-defined descriptive language and descriptive language resolution rules, dictionary just can be utilized to generate the application of multiple programming language, which saves time and the resource of the application of repeatedly writing multiple programming language, thus also can improve the efficiency of the application generating multiple programming language.
See Fig. 7, show a kind of process flow diagram generating the embodiment of the method 3 of the application of multiple programming language based on descriptive language of the present invention, the present embodiment can comprise the following steps:
Step 701: obtain and predefined and describedly apply corresponding descriptive language and descriptive language resolution rules.
Step 702: according to the dictionary of descriptive language resolution rules and multiple programming language, described descriptive language is resolved to the data structure with corresponding relation, described in there is corresponding relation data structure correspond to the variable part of described application.
Step 703: obtain multiple template compressed packages that described multiple programming language is corresponding.
Step 704: successively primary template compressed package is copied to temp directory, to obtain the copy compressed package under described temp directory.
In the present embodiment, first template compressed package is copied to temp directory, and using the copy compressed package under temp directory as operand.
Step 705: obtain the configuration file in the copy compressed package under described temp directory and template file, described configuration file represents the deposit position of template file in described copy compressed package, and template file resolves the rear deposit position of program file in described copy compressed package generated.
Step 706: described template file is resolved to executable code by the data structure described in foundation with corresponding relation.
Step 707: run described executable code to obtain operation result file.
Step 708: described operation result file is deposited in described copy compressed package.
Step 709: delete the configuration file in described copy compressed package and template file, to obtain the application of multiple programming language.
Step 710: receive the download request that client-requested downloads the application of described multiple programming language.
In embodiments of the present invention, after generating the application of multiple programming language, receive the download request that client-requested downloads the application of described multiple programming language, because client difference also just means that operating system may be different, so the application of correspondence is sent to client by the programming language needing the operating system run according to client to support.
Step 711: the application of the programming language of correspondence is sent to described client by the programming language used according to described client.
The present embodiment can after the application generating multiple programming language, according to the client of request down load application the programming language that is suitable for, client is issued in the application of the programming language of correspondence, such as, if client is run on IOS, then client is issued in the application of object C programming language, and if client is run in ANDROID system, then need the same application of JAVA programming language to send to client.
In embodiments of the present invention, only need to write descriptive language and resolution rules thereof, dictionary just can be utilized to obtain the application of multiple programming language, need not repeatedly develop.Thus reduce cost of development and development time, also improve the formation efficiency of the application of multiple programming language.
The descriptive language that the embodiment of the present invention provides, make developer also need not learn multiple programming language, and the application of multiple programming language just can be developed in GPRS descriptive language, thus also reduce the learning cost of developer.Meanwhile, the embodiment of the present invention can be unified to adopt a kind of descriptive language, and this would not produce the error of understanding, thus there will not be the differentiated phenomenon of the function of the application of different programming language.Further, the embodiment of the present invention can also utilize the method for dictionary resolving code fragment, and achieving descriptive language is self-defining code snippet, thus descriptive language can be made more simple and convenient and understandable.
By the description of above embodiment of the method, those skilled in the art can be well understood to the mode that the present invention can add required general hardware platform by software and realize, hardware can certainly be passed through, but in a lot of situation, the former is better embodiment.Based on such understanding, technical scheme of the present invention can embody with the form of software product the part that prior art contributes in essence in other words, this computer software product is stored in a storage medium, comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) perform all or part of step of method described in each embodiment of the present invention.And aforesaid storage medium comprises: ROM (read-only memory) (ROM), random access memory (RAM), magnetic disc or CD etc. various can be program code stored medium.
Corresponding to embodiment of the method above, the embodiment of the present invention also provides a kind of device generating the application of multiple programming language based on descriptive language.See Fig. 8, show a kind of structural representation generating the device embodiment 1 of the application of multiple programming language based on descriptive language, can comprise:
Acquisition module 801, predefined and describedly applies corresponding descriptive language and descriptive language resolution rules for obtaining;
Parsing module 802, for the application adopting the dictionary of described descriptive language resolution rules and multiple programming language described descriptive language to be resolved to described multiple programming language.
In actual applications, shown in figure 9, described parsing module 802 specifically can comprise:
First analyzing sub-module 901, for the dictionary according to described descriptive language resolution rules and described multiple programming language, described descriptive language is resolved to the data structure with corresponding relation, described in there is corresponding relation data structure correspond to the variable part of described application;
Obtain submodule 902, for obtaining multiple template compressed packages corresponding to described multiple programming language;
Generate application submodule 903, for according to the configuration file in described template compressed package and the described application with the multiple programming language of data structure building of corresponding relation.
In actual applications, with reference to shown in Figure 10, described first analyzing sub-module 901 specifically can comprise:
Generate word list submodule 1001, generate word list for the predefined descriptive language according to described application;
Recognin module 1002, for by the word in word list described in regular expression identification;
Translation submodule 1003, translates described word for using the dictionary of described multiple programming language and obtains translation result;
Generate array submodule 1004, for by translation result according to the rules form generate array.
Obtain submodule 902, for obtaining multiple template compressed packages corresponding to described multiple programming language;
Generate application submodule 903, for according to the configuration file in described template compressed package and the described application with the multiple programming language of data structure building of corresponding relation.
In actual applications, with reference to shown in Figure 11, described generation application submodule 903 specifically can comprise:
Obtain file submodule 1101, for obtaining configuration file in current template compressed package and template file, described configuration file represents the deposit position of template file in described current template compressed package, and template file resolves the rear deposit position of program file in described current template compressed package generated;
Second analyzing sub-module 1102, resolves to executable code for the data structure described in foundation with corresponding relation by described template file;
In actual applications, with reference to shown in Figure 12, described second analyzing sub-module 1102 specifically can comprise:
First replaces submodule 1201, for the PHP label in described template file being replaced with other marks of specifying;
Second replaces submodule 1202, for the template label in described template file is replaced with described PHP label;
3rd replaces submodule 1203, for described other marks of specifying are replaced with described PHP label.
Operation code submodule 1103, for running described executable code to obtain operation result file;
Deposit submodule 1104, for being deposited by described operation result file in described current template compressed package;
Delete submodule 1105, for deleting configuration file in described current template compressed package and template file.
In actual applications, with reference to shown in Figure 13, described generation application submodule 903 specifically can also comprise:
Replicon module 1301, for being copied to temp directory by primary template compressed package;
Determine submodule 1302, for using the copy under described temp directory as described current template compressed package.
In the present embodiment, only need by pre-defined descriptive language and descriptive language resolution rules, dictionary just can be utilized to generate the application of multiple programming language, which saves time and the resource of the application of repeatedly writing multiple programming language, thus also can improve the efficiency of the application generating multiple programming language.
See Figure 14, show a kind of structural representation generating the device embodiment 2 of the application of multiple programming language based on descriptive language of the embodiment of the present invention, device disclosed in the present embodiment can comprise:
Acquisition module 801, predefined and describedly applies corresponding descriptive language and descriptive language resolution rules for obtaining;
First analyzing sub-module 901, for according to predefined descriptive language resolution rules, resolves to the data structure with corresponding relation by the predefined descriptive language of described application, and described descriptive language corresponds to the variable part of described application;
Obtain submodule 902, for obtaining multiple template compressed packages corresponding to described multiple programming language.
Replicon module 1301, for being copied to temp directory by primary template compressed package;
Determine submodule 1302, for using the copy under described temp directory as described current template compressed package.
Obtain file submodule 1101, for obtaining configuration file in current template compressed package and template file, described configuration file represents first deposit position of template file in described current template compressed package, and template file resolves rear second deposit position of program file in described current template compressed package generated;
Second analyzing sub-module 1102, resolves to executable code for the data structure described in foundation with corresponding relation by described template file;
Operation code submodule 1103, for running described executable code to obtain operation result file;
Deposit submodule 1104, for being deposited by described operation result file in described current template compressed package;
Delete submodule 1105, for deleting configuration file in described current template compressed package and template file.
Receiving download request module 1401, downloading the download request of the application of described multiple programming language for receiving client-requested;
Sending module 1402, sends to described client for the programming language used according to described client by the application of the programming language of correspondence.
In embodiments of the present invention, only need to write descriptive language and resolution rules thereof, dictionary just can be utilized to obtain the application of multiple programming language, need not repeatedly develop.Thus reduce cost of development and development time, also improve the formation efficiency of the application of multiple programming language.
The descriptive language that the embodiment of the present invention provides, make developer also need not learn multiple programming language, and the application of multiple programming language just can be developed in GPRS descriptive language, thus also reduce the learning cost of developer.Meanwhile, the embodiment of the present invention can be unified to adopt a kind of descriptive language, and this would not produce the error of understanding, thus there will not be the differentiated phenomenon of the function of the application of different programming language.Further, the embodiment of the present invention can also utilize the method for dictionary resolving code fragment, and achieving descriptive language is self-defining code snippet, thus descriptive language can be made more simple and convenient and understandable.
Be understandable that, the present invention can be used in numerous general or special purpose computing system environment or configuration.Such as: personal computer, server computer, handheld device or portable set, laptop device, multicomputer system, system, set top box, programmable consumer-elcetronics devices, network PC, small-size computer, mainframe computer, the distributed computing environment comprising above any system or equipment etc. based on microprocessor.
The present invention can describe in the general context of computer executable instructions, such as program module.Usually, program module comprises the routine, program, object, assembly, data structure etc. that perform particular task or realize particular abstract data type.Also can put into practice the present invention in a distributed computing environment, in these distributed computing environment, be executed the task by the remote processing devices be connected by communication network.In a distributed computing environment, program module can be arranged in the local and remote computer-readable storage medium comprising memory device.
It should be noted that, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment comprising described key element and also there is other identical element.
For device embodiment, because it corresponds essentially to embodiment of the method, so relevant part illustrates see the part of embodiment of the method.Device embodiment described above is only schematic, the wherein said unit illustrated as separating component or can may not be and physically separates, parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of module wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.Those of ordinary skill in the art, when not paying creative work, are namely appreciated that and implement.
The above is only the specific embodiment of the present invention; it should be pointed out that for those skilled in the art, under the premise without departing from the principles of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.

Claims (8)

1. generate a method for the application of multiple programming language based on descriptive language, it is characterized in that, comprising:
Obtain and predefinedly and described apply corresponding descriptive language and descriptive language resolution rules;
Adopt the dictionary of described descriptive language resolution rules and multiple programming language, described descriptive language is resolved to the application of described multiple programming language; Wherein, the dictionary of described employing described descriptive language resolution rules and multiple programming language, resolves to the application of described multiple programming language, specifically comprises by described descriptive language:
According to the dictionary of described descriptive language resolution rules and described multiple programming language, described descriptive language is resolved to the data structure with corresponding relation, described in there is corresponding relation data structure correspond to the variable part of described application; Obtain multiple template compressed packages that described multiple programming language is corresponding, and according to the configuration file in described template compressed package and the described application with the multiple programming language of data structure building of corresponding relation;
Wherein, described in there is corresponding relation data structure be array, then describedly described descriptive language is resolved to the data structure with corresponding relation, specifically comprises:
Predefined descriptive language according to described application generates word list; By the word in word list described in regular expression identification; Use the dictionary of described multiple programming language to translate described word and obtain translation result; With, by translation result form generation array according to the rules.
2. method according to claim 1, is characterized in that, described according to the configuration file in described template compressed package and the described application with the multiple programming language of data structure building of corresponding relation, specifically comprises:
Obtain the configuration file in current template compressed package and template file, described configuration file represents first deposit position of template file in described current template compressed package, and template file resolves rear second deposit position of program file in described current template compressed package generated;
Described template file is resolved to executable code by the data structure described in foundation with corresponding relation;
Run described executable code to obtain operation result file;
Described operation result file is deposited in described current template compressed package;
Delete the configuration file in described current template compressed package and template file.
3. method according to claim 2, is characterized in that, before the configuration file obtained in current template compressed package and template file, also comprises:
Primary template compressed package is copied to temp directory;
Using the copy under described temp directory as described current template compressed package.
4. method according to claim 2, it is characterized in that, described programming language is supertext pre-service PHP programming language, described template file adopts the compiling of PHP programming language, described template file is resolved to executable code by the data structure then described in described foundation with corresponding relation, specifically comprises:
PHP label in described template file is replaced with other marks of specifying;
Template label in described template file is replaced with described PHP label;
Described other marks of specifying are replaced with described PHP label.
5. method according to claim 1, is characterized in that, adopting after described descriptive language to resolve to the application of described multiple programming language by the dictionary of described multiple programming language, also comprises:
Receive the download request that client-requested downloads the application of described multiple programming language;
The application of the programming language of correspondence is sent to described client by the programming language used according to described client.
6. generate a device for the application of multiple programming language based on descriptive language, it is characterized in that, comprising:
Acquisition module, predefined and describedly applies corresponding descriptive language and descriptive language resolution rules for obtaining;
Parsing module, for adopting the dictionary of described descriptive language resolution rules and multiple programming language, resolves to the application of described multiple programming language by described descriptive language; Wherein, described parsing module specifically comprises: the first analyzing sub-module, for the dictionary according to described descriptive language resolution rules and described multiple programming language, described descriptive language is resolved to the data structure with corresponding relation, described in there is corresponding relation data structure correspond to the variable part of described application; Obtain submodule, for obtaining multiple template compressed packages corresponding to described multiple programming language; With, generate application submodule, for according to the configuration file in described template compressed package and the described application with the multiple programming language of data structure building of corresponding relation;
Wherein, described first analyzing sub-module specifically comprises:
Generate word list submodule, generate word list for the predefined descriptive language according to described application; Recognin module, for by the word in word list described in regular expression identification; Translation submodule, translates described word for using the dictionary of described multiple programming language and obtains translation result; With, generate array submodule, for by translation result according to the rules form generate array.
7. device according to claim 6, is characterized in that, described generation application submodule specifically comprises:
Obtain file submodule, for obtaining configuration file in current template compressed package and template file, described configuration file represents first deposit position of template file in described current template compressed package, and template file resolves rear second deposit position of program file in described current template compressed package generated;
Second analyzing sub-module, resolves to executable code for the data structure described in foundation with corresponding relation by described template file;
Operation code submodule, for running described executable code to obtain operation result file;
Deposit submodule, for being deposited by described operation result file in described current template compressed package;
Delete submodule, for deleting configuration file in described current template compressed package and template file.
8. device according to claim 7, is characterized in that, described generation application submodule also comprises:
Replicon module, for being copied to temp directory by primary template compressed package;
Determine submodule, for using the copy under described temp directory as described current template compressed package.
CN201210212289.4A 2012-06-21 2012-06-21 Method and device of application for generating a plurality of programming languages based on descriptive language Active CN102750152B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210212289.4A CN102750152B (en) 2012-06-21 2012-06-21 Method and device of application for generating a plurality of programming languages based on descriptive language

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210212289.4A CN102750152B (en) 2012-06-21 2012-06-21 Method and device of application for generating a plurality of programming languages based on descriptive language

Publications (2)

Publication Number Publication Date
CN102750152A CN102750152A (en) 2012-10-24
CN102750152B true CN102750152B (en) 2015-02-04

Family

ID=47030375

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210212289.4A Active CN102750152B (en) 2012-06-21 2012-06-21 Method and device of application for generating a plurality of programming languages based on descriptive language

Country Status (1)

Country Link
CN (1) CN102750152B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103294478A (en) * 2013-06-17 2013-09-11 宁夏新航信息科技有限公司 Intelligentized programming method of computer software
CN103561082B (en) * 2013-10-30 2017-01-18 北京奇虎科技有限公司 Compressing request processing method and server
CN103713896B (en) * 2013-12-17 2017-01-04 北京京东尚科信息技术有限公司 Method and device is generated for accessing the SDK of server
CN104636174B (en) * 2015-02-02 2018-07-10 惠州Tcl移动通信有限公司 Characteristic value definition and application method and system based on android system
CN107220034B (en) * 2016-03-22 2020-10-16 阿里巴巴集团控股有限公司 Program code marking method and device
CN108491199B (en) * 2018-03-06 2021-04-27 福建天泉教育科技有限公司 Method and terminal for automatically generating interface
CN109117127A (en) * 2018-08-21 2019-01-01 水木康益(北京)信息技术有限公司 Program code generation method, device and computer readable storage medium
CN109271162A (en) * 2018-09-03 2019-01-25 中国建设银行股份有限公司 A kind of page generation method and device
CN109614102A (en) * 2018-10-09 2019-04-12 平安科技(深圳)有限公司 Code automatic generation method, device, electronic equipment and storage medium
CN109976761B (en) * 2019-02-27 2022-06-07 平安科技(深圳)有限公司 Software development kit generation method and device and terminal equipment
CN110109697B (en) * 2019-04-03 2023-08-18 北京旷视科技有限公司 SDK output method and device of neural network model, electronic equipment and storage medium
CN111651156A (en) * 2020-06-04 2020-09-11 广州鲁邦通物联网科技有限公司 Software development kit adaptive to multiple development languages and calling method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1949168A (en) * 2005-10-14 2007-04-18 英业达股份有限公司 Panel program converting system and method thereof
CN101216769A (en) * 2008-01-14 2008-07-09 浙江大学 Hiberarchy system description language SmartC to C code automatic conversion method
CN101739245A (en) * 2008-11-07 2010-06-16 武汉虹信通信技术有限责任公司 Method and device for convertion between extensive makeup language (XML) message and C language program structure

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8762963B2 (en) * 2008-12-04 2014-06-24 Beck Fund B.V. L.L.C. Translation of programming code

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1949168A (en) * 2005-10-14 2007-04-18 英业达股份有限公司 Panel program converting system and method thereof
CN101216769A (en) * 2008-01-14 2008-07-09 浙江大学 Hiberarchy system description language SmartC to C code automatic conversion method
CN101739245A (en) * 2008-11-07 2010-06-16 武汉虹信通信技术有限责任公司 Method and device for convertion between extensive makeup language (XML) message and C language program structure

Also Published As

Publication number Publication date
CN102750152A (en) 2012-10-24

Similar Documents

Publication Publication Date Title
CN102750152B (en) Method and device of application for generating a plurality of programming languages based on descriptive language
EP3433732B1 (en) Converting visual diagrams into code
US20170102925A1 (en) Automatch process and system for software development kit for application programming interface
WO2016196701A1 (en) Natural language engine for coding and debugging
CN106980504A (en) A kind of application development method and its instrument, equipment
CN109145235B (en) Method and device for analyzing webpage and electronic equipment
CN110688307B (en) JavaScript code detection method, device, equipment and storage medium
CN110825619A (en) Automatic generation method and device of interface test case and storage medium
EP3008585B1 (en) Automatic source code generation
CN102693323B (en) Cascading style sheet resolving method, resolver, webpage presentation method and server
CN102346780B (en) The acquisition methods of web page address and acquisition device
CN103914438A (en) Template and tag implementation based excel display and export method and system
CN112749284A (en) Knowledge graph construction method, device, equipment and storage medium
CN111626032A (en) Dynamic word template exporting method and device and storage medium
CN113703862A (en) Configuration-based interface calling method, device, equipment and storage medium
CN114691132A (en) ARXML file generation method, device, equipment and storage medium
CN100458782C (en) Display and installation of portlets on a client platform
US20190073198A1 (en) Multi-flavored software execution from a singular code base
CN113268245A (en) Code analysis method, device and storage medium
CN103500109A (en) Method and device for achieving file collection and software package automatic installation
CN110688315A (en) Interface code detection report generation method, electronic device, and storage medium
US20180032510A1 (en) Automated translation of source code
CN115794214A (en) Application module metadata management method, device, storage medium and device
CN103617079A (en) Method and system for switching between IE6 kernel and novel IE kernel
Huynh et al. Browser app approach: Can it be an answer to the challenges in cross-platform app development?

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20230420

Address after: Room 501-502, 5/F, Sina Headquarters Scientific Research Building, Block N-1 and N-2, Zhongguancun Software Park, Dongbei Wangxi Road, Haidian District, Beijing, 100193

Patentee after: Sina Technology (China) Co.,Ltd.

Address before: 100080, International Building, No. 58 West Fourth Ring Road, Haidian District, Beijing, 20 floor

Patentee before: Sina.com Technology (China) Co.,Ltd.

TR01 Transfer of patent right