WO2020248784A1 - 一种在计算机上实现母语编程的方法 - Google Patents

一种在计算机上实现母语编程的方法 Download PDF

Info

Publication number
WO2020248784A1
WO2020248784A1 PCT/CN2020/091210 CN2020091210W WO2020248784A1 WO 2020248784 A1 WO2020248784 A1 WO 2020248784A1 CN 2020091210 W CN2020091210 W CN 2020091210W WO 2020248784 A1 WO2020248784 A1 WO 2020248784A1
Authority
WO
WIPO (PCT)
Prior art keywords
name
native
language
native language
programming
Prior art date
Application number
PCT/CN2020/091210
Other languages
English (en)
French (fr)
Inventor
周登祥
Original Assignee
周登祥
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 周登祥 filed Critical 周登祥
Publication of WO2020248784A1 publication Critical patent/WO2020248784A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms

Definitions

  • the present invention relates to the technical field of computer applications, in particular to a method for implementing native language programming on a computer.
  • the current computer programming language is based on English. Although it supports the use of Unicode as an identifier to write code, the keyword of the computer programming language is English.
  • the programming interface of the basic library it provides is also English, and the interfaces of other support libraries are also English. For many people who are not familiar with English, these English names are a hindrance to them if they want to write computer programs.
  • the embodiment of the present invention provides a method for realizing native language programming on a computer.
  • the method includes the following steps:
  • the preprocessor queries the native name correspondence table of the programming language file extension according to the project configuration, and selects the file that matches the native name of the programming language extension as the file to be compiled;
  • the syntax analyzer controls the scanner to convert the program code files in the source file list obtained by the preprocessor into a token stream and converts the token stream into an abstract syntax tree, including:
  • the syntax analyzer queries the native name correspondence table of the programming language file extension based on the extension of the source code file to determine the native language type of the program code;
  • the syntax analyzer sets the native name of the scanner's programming language keywords according to the native language type of the program code
  • the syntax analyzer selects the native language name of the class library path name according to the native language type of the program code
  • the syntax analyzer selects the interface declaration file whose identifier name is marked with the native language name according to the native language type of the program code;
  • the scanner judges the type of a certain mark, it queries the native language name of the programming language keyword set.
  • the mark is the native language name of a certain keyword in the programming language, it is determined that the mark is the original language name corresponding to the native language name.
  • the token type of the keyword is the token type of the keyword.
  • the syntax analyzer creates a native language name record node for the identifier declaration node, where the native language name record node contains the original name and native language name of the node;
  • the syntax analyzer When the syntax analyzer generates the identifier declaration node, it calls the scanner to determine whether the next token is a native language name annotation, and if so, creates a native language name record node for the identifier declaration node;
  • the syntax analyzer uses the imported class library path string to query the mother tongue name correspondence table of the class library path name.
  • the imported class library path string is the mother tongue name of the class library path, it generates Use the original name string in the native name record of the class library path as the imported class library path in the import class library declaration;
  • the combiner traverses and processes the abstract syntax tree generated by the syntax analyzer, creates symbol records for the declarations in the abstract syntax tree and places the symbol records in the symbol table, including:
  • an identifier declaration node has a mother tongue name record
  • use the mother tongue name record to create a mother tongue name symbol with the name of the mother tongue
  • the mother tongue name symbol contains the mother tongue name record
  • the type resolution checker calculates the relationship between the symbols and checks the symbols of the abstract syntax tree nodes, including:
  • the type resolution checker processes a node, if the symbol of the node is a native name symbol, then the native name record of the native name type symbol is set to the native name record of the node;
  • the generator generates target files according to programming language rules, including:
  • the native language name correspondence table of the programming language keyword name includes multiple records of the native language name of the keyword, and the native language name record of each keyword includes the programming language keyword name and the native language name of the programming language keyword.
  • the native language name correspondence table of the programming language file extension includes a plurality of native language name records of the programming language file extension, and each native language name record of the programming language file extension includes the original programming language file extension name and the file extension. First name in native language.
  • the native name correspondence table of the class library path name includes a plurality of class library path native language name records, and each class library path native language name record includes the original name of the class library path and the native language name of the class library path.
  • the identifier includes variable name, constant name, function name, interface name, namespace name, class name, attribute name, enumeration type name, enumeration member name, symbol name, text type name, text type value name.
  • FIG. 1 is a schematic flowchart of a method for implementing native language programming on a computer according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of the work flow of the pre-processor provided by an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a working flow of a syntax analyzer provided by an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of the work flow of the combiner provided by an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of the workflow of a type resolution checker provided by an embodiment of the present invention.
  • Fig. 6 is a schematic diagram of the working process of the generator provided by an embodiment of the present invention.
  • the method for implementing native language programming on a computer includes the following steps:
  • S101 Define various native language names of programming language keywords, and generate a native language name correspondence table of programming language keyword names, where each native language name corresponds to a native language name of a programming language keyword.
  • various native name codes defining programming language keywords can be:
  • S102 Define various native language names of the programming language file extension, and generate a native language name correspondence table of the programming language file extension, where each native language name corresponds to a native language name of the programming language file extension.
  • codes of various native language names that define the file extension of a programming language may be:
  • S103 Define various native language names of the class library path name, and generate a native language name correspondence table of the class library path name, where each native language name corresponds to a native language name of the class library path name.
  • the codes of various native language names defining the path name of the class library may be:
  • S104 Define various mother tongue names of the identifier in the interface declaration file, and generate an interface declaration file marked with the name of the mother tongue behind the identifier, where each name of the mother tongue corresponds to an interface declaration file.
  • the codes for defining the various native language names of the identifiers in the interface declaration file can be:
  • S105 The preprocessor queries the native name correspondence table of the programming language file extension according to the project configuration, and selects the file that matches the native name of the programming language extension as the file to be compiled.
  • the syntax analyzer controls the scanner to convert the program code files in the source file list obtained by the preprocessor into a token stream and convert the token stream into an abstract syntax tree, including:
  • the S1061 syntax analyzer queries the native name correspondence table of the programming language file extension based on the extension of the source code file to determine the native language type of the program code;
  • the S1062 syntax analyzer sets the native name of the programming language keywords of the scanner according to the native language type of the program code
  • the S1063 syntax analyzer selects the native language name of the class library path name according to the native language type of the program code
  • the S1064 syntax analyzer selects the interface declaration file whose identifier name is marked with the native language name according to the native language type of the program code;
  • the S1065 scanner determines the type of a certain mark, it queries the native language name of the programming language keyword set.
  • the mark is the native language name of a certain keyword in the programming language, it determines that the mark is the original keyword corresponding to the native language name.
  • Type of token
  • the S1066 scanner judges whether the next mark is the name of the mother tongue, and reads the name of the mother tongue;
  • the S1067 syntax analyzer creates a native language name record node for the identifier declaration node, where the native language name record node contains the original name and native language name of the node to which it belongs;
  • the S1068 syntax analyzer When the S1068 syntax analyzer generates an identifier declaration node, it calls the scanner to determine whether the next token is a native name label, and if so, it creates a native name record node for the identifier declaration node;
  • the S1069 syntax analyzer analyzes the imported class library declaration, it uses the imported class library path string to query the native name correspondence table of the class library path name.
  • the imported class library path string is the mother tongue name of the class library path
  • the generated import uses the original name string in the native name record of the class library path as the import class library path.
  • the S107 combiner traverses and processes the abstract syntax tree generated by the syntax analyzer, creates symbol records for the declarations in the abstract syntax tree, and places the symbol records in the symbol table, including:
  • an identifier declaration node has a mother tongue name record
  • use the mother tongue name record to create a mother tongue name symbol with the name of the mother tongue
  • the mother tongue name symbol contains the mother tongue name record
  • the S108 type analysis checker calculates the relationship between the symbols and checks the symbols of the abstract syntax tree nodes, including:
  • the type resolution checker processes a node, if the symbol of the node is a native name symbol, the native name record of the native name type symbol is set to the native name record of the node.
  • the S109 generator generates target files according to programming language rules, including:
  • the generator When the generator generates the text of a node, if the node has a native name record, the original name of the native name record is used as the text of the node.
  • the generated target file may be:
  • the code written according to the method for implementing native language programming on a computer provided by the embodiment of the present invention may be:
  • the native language name correspondence table of the programming language keyword name includes multiple records of the native language name of the keyword, and the native language name record of each keyword includes the programming language keyword name and the native language name of the programming language keyword.
  • the native language name correspondence table of the programming language file extension includes multiple records of the native language name of the programming language file extension, and each native language name record of the programming language file extension includes the original programming language file extension name and file extension. Mother tongue name.
  • the native name correspondence table of the class library path name includes multiple records of the native language name of the class library path, and each native name record of the class library path includes the original name of the class library path and the native name of the class library path.
  • the identifier includes variable name, constant name, function name, interface name, namespace name, class name, attribute name, enumeration type name, enumeration member name, symbol name, text type name, text type value name .
  • the method for implementing native language programming on a computer is to define various native language names of programming language keywords, various native language names of programming language file extensions, various native language names of class library path names, and interface declarations
  • Various native names of identifiers in files, preprocessors, scanners, syntactic analyzers, unions, type resolution checkers and generators in the compiler provide support to realize native language programming, reducing the professional requirements for personnel , Simplifies the difficulty of native language programming, is conducive to the popularization of native language programming, and improves the versatility of native language programming.
  • memory may include non-permanent memory in computer-readable media, random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM), and memory includes At least one memory chip.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
  • a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.
  • the computing device includes one or more processors (CPU), input/output interfaces, network interfaces, and memory.
  • processors CPU
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-permanent memory in a computer readable medium, random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM).
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash memory
  • Computer-readable media includes permanent and non-permanent, removable and non-removable media.
  • Information storage can be realized by any method or technology.
  • the information can be computer-readable instructions, data structures, program modules, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, Magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices. According to the definition in this article, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • this application can be provided as methods, systems, or computer program products. Therefore, this application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

一种在计算机上实现母语编程的方法,涉及计算机应用技术领域,通过定义编程语言关键字的各种母语名称、编程语言文件扩展名的各种母语名称、类库路径名称的各种母语名称及接口声明文件中标识符的各种母语名称,编译器中的预处理器、扫描器、语法分析器、联合器、类型解析检查器和生成器提供支持以实现母语编程,降低了对人员的专业性方面的要求,简化了母语编程的难度,有利于母语编程的普及,提高了母语编程的通用性。

Description

一种在计算机上实现母语编程的方法 技术领域
本发明涉及计算机应用技术领域,具体涉及一种在计算机上实现母语编程的方法。
背景技术
当前的计算机编程语言是基于英语的,虽然其支持使用统一码作为标识符编写代码,但是计算机编程语言的关键字是英语,它提供的基础库编程接口也是英语,其它的支持库的接口也是英语,对于许多不熟悉英语的人来说,要想编写计算机程序,这些英语名称对他们来说是有阻碍的。
在专利号为CN201610475731的专利申请中,关于母语名称的标注,它是在接口声明文件外标注母语名称,使得母语名称脱离接口声明环境,导致不方便使用且编译器需要扫描母语标注文件再与原始名称节点关联,使得编译器操作起来比较复杂,对人员的专业性要求较高,不利于母语编程的普及。
专利号为CN201610460121的专利申请主要是针对解释型计算机语言在运行时支持母语编程,没有对代码编译时母语支持提出解决办法,只能在特定的环境下运行,具有一定的局限性。
发明内容
为解决现有技术的不足,本发明实施例提供了一种在计算机上实现母语编程的方法,该方法包括以下步骤:
(1)定义编程语言关键字的各种母语名称,生成编程语言关键字 名称的母语名称对应表,其中,每种母语名称对应一个编程语言关键字的母语名称;
(2)定义编程语言文件扩展名的各种母语名称,生成编程语言文件扩展名的母语名称对应表,其中,每种母语名称对应一个编程语言文件扩展名的母语名称;
(3)定义类库路径名称的各种母语名称,生成类库路径名称的母语名称对应表,其中,每种母语名称对应一个类库路径名称的母语名称;
(4)定义接口声明文件中标识符的各种母语名称,生成标识符后面携带母语名称标注的接口声明文件,其中,每种母语名称对应一个接口声明文件;
(5)预处理器根据项目配置,查询编程语言文件扩展名的母语名称对应表,选择符合编程语言扩展名母语名称的文件为待编译文件;
(6)语法分析器控制扫描器将预处理器得到的源文件列表中的程序代码文件转化为记号流并将所述记号流转化为抽象语法树,包括:
(61)语法分析器根据源码文件的扩展名,查询编程语言文件扩展名的母语名称对应表,确定程序代码的母语类型;
(62)语法分析器根据程序代码的母语类型,设置扫描器的编程语言关键字的母语名称;
(63)语法分析器根据程序代码的母语类型,选择类库路径名称的母语名称;
(64)语法分析器根据程序代码的母语类型,选择标识符名称带 母语名称标注的接口声明文件;
(65)扫描器在判断某个记号的类型时,查询设置的编程语言关键字的母语名称,当该记号是编程语言某一关键字的母语名称时,确定该记号为该母语名称对应的原始关键字的记号类型;
(66)扫描器判断下一记号是否为母语名称标注,读取母语名称;
(67)语法分析器为标识符声明节点创建母语名称记录节点,其中,母语名称记录节点包含所属节点的原始名称和母语名称;
(68)语法分析器在生成标识符声明节点时,调用扫描器判断下一个记号是否为母语名称标注,如果是,则为所述标识符声明节点创建母语名称记录节点;
(69)语法分析器在分析引入类库声明时,使用引入类库路径字串查询类库路径名称的母语名称对应表,当引入类库路径字串是类库路径的母语名称时,在生成的引入类库声明中使用类库路径母语名称记录中的原始名称字串作为引入类库路径;
(7)联合器遍历并处理语法分析器生成的抽象语法树,为抽象语法树中的声明创建符号记录并把符号记录放到符号表中,包括:
如果一个标识符声明节点有母语名称记录,则用该母语名称记录创建以母语名称为名称的母语名称符号,母语名称符号包含母语名称记录,并把该母语名称符号添加到该标识符声明节点的符号所在的符号表中;
(8)类型解析检查器计算出符号之间的关系,检查抽象语法树节点的符号,包括:
类型解析检查器在处理一个节点时,如果该节点的符号是母语名称符号,则将所述母语名称类型符号的母语名称记录设置为该节点的母语名称记录;
(9)生成器根据编程语言规则,生成目标文件,包括:
(91)生成器在生成一个节点的文字时,如果这个节点有母语名称记录,则使用该母语名称记录的原始名称作为该节点的文字。
优选地,所述编程语言关键字名称的母语名称对应表包括多条关键字的母语名称记录,每条关键字的母语名称记录包括编程语言关键字名称和编程语言关键字母语名称。
优选地,所述编程语言文件扩展名的母语名称对应表包括多条编程语言文件扩展名的母语名称记录,每条编程语言文件扩展名的母语名称记录包括编程语言原始文件扩展名名称和文件扩展名母语名称。
优选地,所述类库路径名称的母语名称对应表包括多条类库路径母语名称记录,每条类库路径母语名称记录包括类库路径原始名称和类库路径母语名称
优选地,所述标识符包括变量名称、常量名称、函数名称、接口名称、命名空间名称、类名称、属性名称、枚举类型名称、枚举成员名称、符号名称、文字类型名称、文字类型值名称。
本发明实施例提供的在计算机上实现母语编程的方法具有以下有益效果:
使得人们能够方便地使用自己的母语来编写计算机程序,能够通过各种母语使用现有的众多使用英语定义的功能,降低了对人员的专 业性要求,简化了母语编程的难度,有利于母语编程的普及,提高了母语编程的通用性。
附图说明
图1为本发明实施例提供的在计算机上实现母语编程的方法流程示意图;
图2为本发明实施例提供的预处理器的工作流程示意图;
图3为本发明实施例提供的语法分析器的工作流程示意图;
图4为本发明实施例提供的联合器的工作流程示意图;
图5为本发明实施例提供的类型解析检查器的工作流程示意图;
图6为本发明实施例提供的生成器的工作流程示意图。
具体实施方式
以下结合附图和具体实施例对本发明作具体的介绍。
参见图1,本发明实施例提供的在计算机上实现母语编程的方法包括以下步骤:
S101,定义编程语言关键字的各种母语名称,生成编程语言关键字名称的母语名称对应表,其中,每种母语名称对应一个编程语言关键字的母语名称。
作为一个具体的实施例,定义编程语言关键字的各种母语名称代码可以为:
Figure PCTCN2020091210-appb-000001
Figure PCTCN2020091210-appb-000002
S102,定义编程语言文件扩展名的各种母语名称,生成编程语言文件扩展名的母语名称对应表,其中,每种母语名称对应一个编程语言文件扩展名的母语名称。
作为一个具体的实施例,定义编程语言文件扩展名的各种母语名称的代码可以为:
Figure PCTCN2020091210-appb-000003
Figure PCTCN2020091210-appb-000004
S103,定义类库路径名称的各种母语名称,生成类库路径名称的母语名称对应表,其中,每种母语名称对应一个类库路径名称的母语名称。
作为一个具体的实施例,定义类库路径名称的各种母语名称的代码可以为:
Figure PCTCN2020091210-appb-000005
S104,定义接口声明文件中标识符的各种母语名称,生成标识符后面携带母语名称标注的接口声明文件,其中,每种母语名称对应一个接口声明文件。
作为一个具体的实施例,定义接口声明文件中标识符的各种母语名称的代码可以为:
Figure PCTCN2020091210-appb-000006
Figure PCTCN2020091210-appb-000007
Figure PCTCN2020091210-appb-000008
Figure PCTCN2020091210-appb-000009
S105,预处理器根据项目配置,查询编程语言文件扩展名的母语名称对应表,选择符合编程语言扩展名母语名称的文件为待编译文件。
S106,语法分析器控制扫描器将预处理器得到的源文件列表中的程序代码文件转化为记号流并将该记号流转化为抽象语法树,包括:
S1061语法分析器根据源码文件的扩展名,查询编程语言文件扩展名的母语名称对应表,确定程序代码的母语类型;
S1062语法分析器根据程序代码的母语类型,设置扫描器的编程语言关键字的母语名称;
S1063语法分析器根据程序代码的母语类型,选择类库路径名称的母语名称;
S1064语法分析器根据程序代码的母语类型,选择标识符名称带母语名称标注的接口声明文件;
S1065扫描器在判断某个记号的类型时,查询设置的编程语言关键字的母语名称,当该记号是编程语言某一关键字的母语名称时,确定该记号为该母语名称对应的原始关键字的记号类型;
S1066扫描器判断下一记号是否为母语名称标注,读取母语名称;
S1067语法分析器为标识符声明节点创建母语名称记录节点,其中,母语名称记录节点包含所属节点的原始名称和母语名称;
S1068语法分析器在生成标识符声明节点时,调用扫描器判断下一个记号是否为母语名称标注,如果是,则为该标识符声明节点创建母语名称记录节点;
S1069语法分析器在分析引入类库声明时,使用引入类库路径字串查询类库路径名称的母语名称对应表,当引入类库路径字串是类库路径的母语名称时,在生成的引入类库声明中使用类库路径母语名称记录中的原始名称字串作为引入类库路径。
S107联合器遍历并处理语法分析器生成的抽象语法树,为抽象语法树中的声明创建符号记录并把符号记录放到符号表中,包括:
如果一个标识符声明节点有母语名称记录,则用该母语名称记录创建以母语名称为名称的母语名称符号,母语名称符号包含母语名称记录,并把该母语名称符号添加到该标识符声明节点的符号所在的符号表中。
S108类型解析检查器计算出符号之间的关系,检查抽象语法树节点的符号,包括:
类型解析检查器在处理一个节点时,如果该节点的符号是母语名 称符号,则将该母语名称类型符号的母语名称记录设置为该节点的母语名称记录。
S109生成器根据编程语言规则,生成目标文件,包括:
生成器在生成一个节点的文字时,如果这个节点有母语名称记录,则使用该母语名称记录的原始名称作为该节点的文字。
作为一个具体的实施例,生成的目标文件可以为:
Figure PCTCN2020091210-appb-000010
Figure PCTCN2020091210-appb-000011
作为另一个具体的实施例,根据本发明实施例提供的在计算机上实现母语编程的方法所编写的代码可以为:
Figure PCTCN2020091210-appb-000012
Figure PCTCN2020091210-appb-000013
可选地,编程语言关键字名称的母语名称对应表包括多条关键字的母语名称记录,每条关键字的母语名称记录包括编程语言关键字名称和编程语言关键字母语名称。
可选地,编程语言文件扩展名的母语名称对应表包括多条编程语言文件扩展名的母语名称记录,每条编程语言文件扩展名的母语名称记录包括编程语言原始文件扩展名名称和文件扩展名母语名称。
可选地,类库路径名称的母语名称对应表包括多条类库路径母语名称记录,每条类库路径母语名称记录包括类库路径原始名称和类库路径母语名称。
可选地,标识符包括变量名称、常量名称、函数名称、接口名称、命名空间名称、类名称、属性名称、枚举类型名称、枚举成员名称、符号名称、文字类型名称、文字类型值名称。
本发明实施例提供的在计算机上实现母语编程的方法,通过定义编程语言关键字的各种母语名称、编程语言文件扩展名的各种母语名称、类库路径名称的各种母语名称及接口声明文件中标识符的各种母语名称,编译器中的预处理器、扫描器、语法分析器、联合器、类型解析检查器和生成器提供支持以实现母语编程,降低了对人员的专业性要求,简化了母语编程的难度,有利于母语编程的普及,提高了母语编程的通用性。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
可以理解的是,上述方法及装置中的相关特征可以相互参考。另 外,上述实施例中的“第一”、“第二”等是用于区分各实施例,而并不代表各实施例的优劣。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。
此外,存储器可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM),存储器包括至少一个存储芯片。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序 指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
存储器可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。存储器是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体 可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括要素的过程、方法、商品或者设备中还存在另外的相同要素。
本领域技术人员应明白,本申请的实施例可提供为方法、系统或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计 算机程序产品的形式。
以上仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。

Claims (5)

  1. 一种在计算机上实现母语编程的方法,其特征在于,包括:
    (1)定义编程语言关键字的各种母语名称,生成编程语言关键字名称的母语名称对应表,其中,每种母语名称对应一个编程语言关键字的母语名称;
    (2)定义编程语言文件扩展名的各种母语名称,生成编程语言文件扩展名的母语名称对应表,其中,每种母语名称对应一个编程语言文件扩展名的母语名称;
    (3)定义类库路径名称的各种母语名称,生成类库路径名称的母语名称对应表,其中,每种母语名称对应一个类库路径名称的母语名称;
    (4)定义接口声明文件中标识符的各种母语名称,生成标识符后面携带母语名称标注的接口声明文件,其中,每种母语名称对应一个接口声明文件;
    (5)预处理器根据项目配置,查询编程语言文件扩展名的母语名称对应表,选择符合编程语言扩展名母语名称的文件为待编译文件;
    (6)语法分析器控制扫描器将预处理器得到的源文件列表中的程序代码文件转化为记号流并将所述记号流转化为抽象语法树,包括:
    (61)语法分析器根据源码文件的扩展名,查询编程语言文件扩展名的母语名称对应表,确定程序代码的母语类型;
    (62)语法分析器根据程序代码的母语类型,设置扫描器的编程 语言关键字的母语名称;
    (63)语法分析器根据程序代码的母语类型,选择类库路径名称的母语名称;
    (64)语法分析器根据程序代码的母语类型,选择标识符名称带母语名称标注的接口声明文件;
    (65)扫描器在判断某个记号的类型时,查询设置的编程语言关键字的母语名称,当该记号是编程语言某一关键字的母语名称时,确定该记号为该母语名称对应的原始关键字的记号类型;
    (66)扫描器能够判断下一记号是否为母语名称标注,读取母语名称;
    (67)语法分析器为标识符声明节点创建母语名称记录节点,其中,母语名称记录节点包含所属节点的原始名称和母语名称;
    (68)语法分析器在生成标识符声明节点时,调用扫描器判断下一个记号是否为母语名称标注,如果是,则为所述标识符声明节点创建母语名称记录节点;
    (69)语法分析器在分析引入类库声明时,使用引入类库路径字串查询类库路径名称的母语名称对应表,当引入类库路径字串是类库路径的母语名称时,在生成的引入类库声明中使用类库路径母语名称记录中的原始名称字串作为引入类库路径;
    (7)联合器遍历并处理语法分析器生成的抽象语法树,为抽象语法树中的声明创建符号记录并把符号记录放到符号表中,包括:
    如果一个标识符声明节点有母语名称记录,则用该母语名称记录 创建以母语名称为名称的母语名称符号,母语名称符号包含母语名称记录,并把该母语名称符号添加到该标识符声明节点的符号所在的符号表中;
    (8)类型解析检查器计算出符号之间的关系,检查抽象语法树节点的符号,包括:
    类型解析检查器在处理一个节点时,如果该节点的符号是母语名称符号,则将所述母语名称类型符号的母语名称记录设置为该节点的母语名称记录;
    (9)生成器根据编程语言规则,生成目标文件,包括:
    (91)生成器在生成一个节点的文字时,如果这个节点有母语名称记录,则使用该母语名称记录的原始名称作为该节点的文字。
  2. 根据权利要求1所述的在计算机上实现母语编程的方法,其特征在于,
    所述编程语言关键字名称的母语名称对应表包括多条关键字的母语名称记录,每条关键字的母语名称记录包括编程语言关键字名称和编程语言关键字母语名称。
  3. 根据权利要求1所述的在计算机上实现母语编程的方法,其特征在于,
    所述编程语言文件扩展名的母语名称对应表包括多条编程语言文件扩展名的母语名称记录,每条编程语言文件扩展名的母语名称记录包括编程语言原始文件扩展名名称和文件扩展名母语名称。
  4. 根据权利要求1所述的在计算机上实现母语编程的方法,其 特征在于,
    所述类库路径名称的母语名称对应表包括多条类库路径母语名称记录,每条类库路径母语名称记录包括类库路径原始名称和类库路径母语名称
  5. 根据权利要求1所述的在计算机上实现母语编程的方法,其特征在于,
    所述标识符包括变量名称、常量名称、函数名称、接口名称、命名空间名称、类名称、属性名称、枚举类型名称、枚举成员名称、符号名称、文字类型名称、文字类型值名称。
PCT/CN2020/091210 2019-06-10 2020-05-20 一种在计算机上实现母语编程的方法 WO2020248784A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910495118.9 2019-06-10
CN201910495118.9A CN110221825B (zh) 2019-06-10 2019-06-10 一种在计算机上实现母语编程的方法

Publications (1)

Publication Number Publication Date
WO2020248784A1 true WO2020248784A1 (zh) 2020-12-17

Family

ID=67816022

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/091210 WO2020248784A1 (zh) 2019-06-10 2020-05-20 一种在计算机上实现母语编程的方法

Country Status (2)

Country Link
CN (1) CN110221825B (zh)
WO (1) WO2020248784A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110221825B (zh) * 2019-06-10 2022-11-18 周登祥 一种在计算机上实现母语编程的方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070044074A1 (en) * 2005-08-18 2007-02-22 Fant Karl M Method and language for process expression
CN106126227A (zh) * 2016-06-22 2016-11-16 北京普会科技有限公司 一种在计算机上实现跨人类语言写代码的方法
CN106155756A (zh) * 2016-06-24 2016-11-23 北京普会科技有限公司 一种在计算机上实现跨人类语言编程的方法
CN106227531A (zh) * 2016-07-21 2016-12-14 北京普会科技有限公司 一种在计算机上实现母语编程的方法
CN110221825A (zh) * 2019-06-10 2019-09-10 周登祥 一种在计算机上实现母语编程的方法

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1889043A (zh) * 2006-07-17 2007-01-03 大连大有吴涛易语言软件开发有限公司 计算机编程中使用人类自然语言的方法
CN101174207A (zh) * 2007-11-05 2008-05-07 马旭东 一种能够使用母语开发多种高级语言程序的系统和方法
CN102681877A (zh) * 2011-03-15 2012-09-19 刘明前 一种计算机程序设计语言系统和创建方法
US9880820B2 (en) * 2013-06-02 2018-01-30 Microsoft Technology Licensing, Llc Programming language with extensions using dynamic keywords

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070044074A1 (en) * 2005-08-18 2007-02-22 Fant Karl M Method and language for process expression
CN106126227A (zh) * 2016-06-22 2016-11-16 北京普会科技有限公司 一种在计算机上实现跨人类语言写代码的方法
CN106155756A (zh) * 2016-06-24 2016-11-23 北京普会科技有限公司 一种在计算机上实现跨人类语言编程的方法
CN106227531A (zh) * 2016-07-21 2016-12-14 北京普会科技有限公司 一种在计算机上实现母语编程的方法
CN110221825A (zh) * 2019-06-10 2019-09-10 周登祥 一种在计算机上实现母语编程的方法

Also Published As

Publication number Publication date
CN110221825A (zh) 2019-09-10
CN110221825B (zh) 2022-11-18

Similar Documents

Publication Publication Date Title
US7305614B2 (en) Interoperable retrieval and deposit using annotated schema to interface between industrial document specification languages
Schulte et al. A multi-language computing environment for literate programming and reproducible research
US7624114B2 (en) Automatically generating web forms from database schema
US9607061B2 (en) Using views of subsets of nodes of a schema to generate data transformation jobs to transform input files in first data formats to output files in second data formats
US7792851B2 (en) Mechanism for defining queries in terms of data objects
US7499931B2 (en) Method and apparatus for approximate projection of XML documents
US20220269702A1 (en) Intelligent annotation of entity-relationship data models
WO2020248784A1 (zh) 一种在计算机上实现母语编程的方法
Bank et al. A Survey of Text Mining Architectures and the UIMA Standard.
CN105867886B (zh) 一种写表格的方法及装置
Lyu et al. CRUD-RAG: A comprehensive chinese benchmark for retrieval-augmented generation of large language models
Irwin et al. Object oriented metrics: Precision tools and configurable visualisations
CN111475534B (zh) 一种数据查询方法及相关设备
US20070038666A1 (en) Independent explicit interface implementation
Rose et al. Virtual XML: A toolbox and use cases for the XML world view
US7487439B1 (en) Method and apparatus for converting between data sets and XML documents
Ibraheem et al. Adapting Big-Step Semantics to Small-Step Style: Coinductive Interpretations and" Higher-Order" Derivations.
US20050198055A1 (en) Query-driven partial materialization of relational-to-hierarchical mappings
Labath et al. A uniform programmning language for implementing XML standards
Diaconescu From universal logic to computer science, and back
Polydoros et al. GraphOnto: OWL-Based Ontology Management and Multimedia Annotation in the DS-MIRF Framework.
US11210454B2 (en) Method for preparing documents written in markup languages while implementing a user interface for dealing with data of an information system
Pavlát Transformace XML dokumentů na základě uživatelsky definovaných pravidel
Pavlát Transforming XML documents based on user-defined rules
Beebe A Bibliography of Publications about SGML, the Standard Generalized Markup Language: 2000–2009

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20821903

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20821903

Country of ref document: EP

Kind code of ref document: A1