CN106227531B - A method of realizing mother tongue programming on computers - Google Patents

A method of realizing mother tongue programming on computers Download PDF

Info

Publication number
CN106227531B
CN106227531B CN201610581217.5A CN201610581217A CN106227531B CN 106227531 B CN106227531 B CN 106227531B CN 201610581217 A CN201610581217 A CN 201610581217A CN 106227531 B CN106227531 B CN 106227531B
Authority
CN
China
Prior art keywords
statement
alias
title
keyword
programming
Prior art date
Application number
CN201610581217.5A
Other languages
Chinese (zh)
Other versions
CN106227531A (en
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 周登祥
Priority to CN201610581217.5A priority Critical patent/CN106227531B/en
Publication of CN106227531A publication Critical patent/CN106227531A/en
Application granted granted Critical
Publication of CN106227531B publication Critical patent/CN106227531B/en

Links

Abstract

The invention belongs to computer application fields, and in particular to a method of mother tongue programming is realized on computers.A method of it realizing mother tongue programming on computers, includes the following steps: (1), the keyword for the programming language being arranged under different human languages and precompile instruction;(2) alias of the title for the code bank interface statement that setting relies on.

Description

A method of realizing mother tongue programming on computers

Technical field

The invention belongs to computer application fields, and in particular to a method of mother tongue programming is realized on computers.

Background technique

The computer programming languages such as present C/C++ are based on English, although its support uses Unicode as mark Symbol, but its keyword is English, the base library programming interface provided is English, and the people for being unfamiliar with English for many comes It says, to write C/C++ code, these English names have obstruction for them.

Summary of the invention

Goal of the invention: the present invention has made improvements in view of the above-mentioned problems of the prior art, i.e., the invention discloses one kind The method for realizing mother tongue programming on computers allows the computer programming languages such as C/C++ to realize mother tongue programming, different by setting The alias that the keyword of programming language under human language and precompile instruction and setting program bank interface are stated, allows people can be with It communicates in one's mother tongue to program.

Technical solution: a method of it realizing mother tongue programming on computers, includes the following steps:

(1), keyword and the precompile instruction of the programming language under different human languages are set;

(11) human language precompile instruction is increased newly, for stating what the programming language keyword used and precompile instructed Human language;

(12) it in the code beginning write, is used using human language precompile increased in step (11) instruction statement Program human language type set;

(13) stage for making morphological analysis to the code for writing completion in compiler, the statement being resolved in step (12) are used When the programming human language type set arrived, the programming language of the specified human language of creation human language precompile instruction is crucial The hash table of word identifier set and programming language precompile instruction identifier set hash table, programming language keyword identifier collection Closing includes keyword strings and key word type in hash table, is wrapped in programming language precompile instruction identifier set hash table The string of instruction character containing precompile and precompile instruction type;

(14) when whether judge identifier is keyword, first judged using the type of identifier of default, if not inquiring To the identifier, then the programming language keyword identifier set hash table created in query steps (13) judges whether it is pass Key word then inquires the key word type if it is keyword;

(15) when judging precompile instruction type, first judged using the precompile instruction type of default, if judgement Failure, then the programming language precompile instruction identifier set hash table created in query steps (13), and judge that precompile refers to The type of order;

(2) alias of the title for the code bank interface statement that setting relies on;

(21) alias definition keyword is increased newly, for defining the alias of statement title;

(22) using the alias of the alias definition keyword definition code bank interface statement title in step (21), the sound The content of the alias of bright title includes the name path of alias name, primitive name title and primitive name title;

(23) when programming is needed using code bank interface, the title comprising definition code bank interface statement in step (22) The code of alias;

(24) when compiler is resolved to the alias of definition code bank interface statement title in step (22), according to primitive name The name path of title finds statement context belonging to primitive name title, above and below the statement belonging to primitive name statement record In text, inquires using primitive name as the set of the statement record of title, be that each is recorded by the statement of title of the primitive name An alias statement record is created with alias, alias statement record uses alias as title, and alias statement record is comprising corresponding to Original claim record reference, newly-built alias statement record is increased to statement context belonging to primitive name title;

(25) when compiler is recorded according to name query to statement, the type of first judgement statement record, if it is alias Statement record then records corresponding original claim with alias statement and records.

The utility model has the advantages that a kind of method for realizing mother tongue programming on computers disclosed by the invention has below beneficial to effect Fruit:

1, the support for increasing and programming to a certain human language can be facilitated, programmed when needing support new human language When, the keyword and precompile instruction, the base library that programming language is arranged for needing to be arranged the programming language under the human language connect The alias for the third party library interface that the alias of mouth and setting need;

2, using this method, known human language programming is can be used in developer;

3, the code that different human languages write out can be mutually general, provides the alias setting of different human languages, so that it may With the code library for calling different human languages to write out;

4, the code that other human language is developed can be used, can occur a variety of human languages simultaneously in code and write Program;

5, existing code library can be reused.There is provided alias setting, so that it may existing code library be allowed to support a variety of mankind Language.

Detailed description of the invention

Fig. 1 is the dendrogram of the name path of statement;

Fig. 2 is the dendrogram that statement is recorded in compiler;

Fig. 3 is to increase the dendrogram for stating to be recorded in compiler after alias statement record.

Specific embodiment

Detailed description of specific embodiments of the present invention below.

A method of it realizing mother tongue programming on computers, includes the following steps:

(1), keyword and the precompile instruction of the programming language under different human languages are set;

(11) human language precompile instruction is increased newly, for stating what the programming language keyword used and precompile instructed Human language;

(12) it in the code beginning write, is used using human language precompile increased in step (11) instruction statement Program human language type set;

(13) stage for making morphological analysis to the code for writing completion in compiler, the statement being resolved in step (12) are used When the programming human language type set arrived, the programming language of the specified human language of creation human language precompile instruction is crucial The hash table of word identifier set and programming language precompile instruction identifier set hash table, programming language keyword identifier collection Closing includes keyword strings and key word type in hash table, is wrapped in programming language precompile instruction identifier set hash table The string of instruction character containing precompile and precompile instruction type;

(14) when whether judge identifier is keyword, first judged using the type of identifier of default, if not inquiring To the identifier, then the programming language keyword identifier set hash table created in query steps (13) judges whether it is pass Key word then inquires the key word type if it is keyword;

(15) when judging precompile instruction type, first judged using the precompile instruction type of default, if judgement Failure, then the programming language precompile instruction identifier set hash table created in query steps (13), and judge that precompile refers to The type of order;

Increase precompile instruction _ _ 0__, which is used to the programming human language type in addition to English for stating to use Set.Such as 1 for Chinese.

#__0__1//statement is instructed using Chinese programming language keyword and precompile

# defines size 12345

Adjusting method 1 ()

Whole first=10;

Whole second=size;

Whole third=first+second;

Return to third;

}

The cmi code is equivalent to English code:

#define size 12345

Int method 1 ()

First=10 int;

Int second=size;

Third=first of int+second;

Return third;

}

(2) alias of the title for the code bank interface statement that setting relies on;

(21) alias definition keyword is increased newly, for defining the alias of statement title;

(22) using the alias of the alias definition keyword definition code bank interface statement title in step (21), the sound The content of the alias of bright title includes the name path of alias name, primitive name title and primitive name title;

(23) when programming is needed using code bank interface, the title comprising definition code bank interface statement in step (22) The code of alias;

(24) when compiler is resolved to the alias of definition code bank interface statement title in step (22), according to primitive name The name path of title finds statement context belonging to primitive name title, above and below the statement belonging to primitive name statement record In text, inquires using primitive name as the set of the statement record of title, be that each is recorded by the statement of title of the primitive name An alias statement record is created with alias, alias statement record uses alias as title, and alias statement record is comprising corresponding to Original claim record reference, newly-built alias statement record is increased to statement context belonging to primitive name title;

(25) when compiler is recorded according to name query to statement, the type of first judgement statement record, if it is alias Statement record then records corresponding original claim with alias statement and records.

The name path of one statement primitive name title refers in code logic, since global scope, reaches this The path of a statement can be indicated with arborescence.Such as: there is code:

Const int A=10;

struct SS{int a;int b;};

namesapce NN{class CC{int a;int b;};

class DD{void f();void f(int i);};}

The dendrogram of the name path of the statement of these codes as shown in Figure 1,

Statement record refers to that in compiler, compiler is the data segment of each statement creation, which includes statement Title, the contents such as statement type.

Statement context belonging to primitive name title refers to that in compiler, compiler is tree-like to statement and statement path The expression of structure.It for stating the root in path, is indicated with overall situation statement context, the node table in other statement tree structures Show.The dendrogram that the statement of above code is recorded in compiler is as shown in Figure 2.

Increase new key _ _ 1__, for defining the alias of statement title.

Call the aliased codes of statement title defined below:

_ _ 1__ first=A;

_ _ 1__ second=SS;

_ _ 1__ fourth=SS::a;

Penta=SS::b of _ _ 1__;

Third=NN of _ _ 1__;

_ _ 1__ oneself=NN::CC;

_ _ 1__ fourth=NN::CC::a;

Penta=NN::CC::b of _ _ 1__;

_ _ 1__ heptan=NN::DD;

_ _ 1__ is ugly=NN::DD::f;

It is as shown in Figure 3 to the dendrogram of the expression of statement record in compiler.

After the aliased codes comprising definition statement title, following Chinese can be used to call these statements:

#__0__1

Third:: oneself certain;

Certain fourth=first;

Certain penta=first of;

Heptan 2;

Certain 2. ugly ();

Certain 2. ugly (certain fourth);

Embodiments of the present invention are elaborated above.But present invention is not limited to the embodiments described above, Technical field those of ordinary skill within the scope of knowledge, can also do without departing from the purpose of the present invention Various change out.

Claims (1)

1. a kind of method for realizing mother tongue programming on computers, which comprises the steps of:
(1), keyword and the precompile instruction of the programming language under different human languages are set;
(11) human language precompile instruction is increased newly, for stating the mankind of the programming language keyword used and precompile instruction Language;
(12) in the code beginning write, the programming used using human language precompile increased in step (11) instruction statement Human language type set;
(13) stage for making morphological analysis to the code for writing completion in compiler, what the statement being resolved in step (12) was used When programming human language type set, the programming language keyword mark of the specified human language of creation human language precompile instruction Know symbol set hash table and programming language precompile instruction identifier set hash table, programming language keyword identifier set dissipates Include keyword strings and key word type in list, includes pre- in programming language precompile instruction identifier set hash table Compile instruction character string and precompile instruction type;
(14) when whether judge identifier is keyword, first judged using the type of identifier of default, if not inquiring this Identifier, the then programming language keyword identifier set hash table created in query steps (13), judges whether it is keyword, If it is keyword, then the key word type is inquired;
(15) when judging precompile instruction type, first judged using the precompile instruction type of default, if judgement failure, The programming language precompile instruction identifier set hash table then created in query steps (13), and judge the class of precompile instruction Type;
(2) alias of the title for the code bank interface statement that setting relies on;
(21) alias definition keyword is increased newly, for defining the alias of statement title;
(22) using the alias of the alias definition keyword definition code bank interface statement title in step (21), the statement name The content of the alias of title includes the name path of alias name, primitive name title and primitive name title;
(23) when programming is needed using code bank interface, the title alias comprising definition code bank interface statement in step (22) Code;
(24) when compiler is resolved to the alias of definition code bank interface statement title in step (22), according to primitive name title Name path, find statement context belonging to primitive name title, primitive name statement record belonging to statement context in, It inquires using primitive name as the set of the statement record of title, is each using the primitive name as the statement record alias of title An alias statement record is created, alias statement record uses alias as title, and alias statement record is comprising corresponding original Newly-built alias statement record is increased to statement context belonging to primitive name title by the reference for stating record;
(25) when compiler is recorded according to name query to statement, the type of first judgement statement record, if it is alias statement Record then records corresponding original claim with alias statement and records.
CN201610581217.5A 2016-07-21 2016-07-21 A method of realizing mother tongue programming on computers CN106227531B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610581217.5A CN106227531B (en) 2016-07-21 2016-07-21 A method of realizing mother tongue programming on computers

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610581217.5A CN106227531B (en) 2016-07-21 2016-07-21 A method of realizing mother tongue programming on computers

Publications (2)

Publication Number Publication Date
CN106227531A CN106227531A (en) 2016-12-14
CN106227531B true CN106227531B (en) 2019-05-21

Family

ID=57531154

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610581217.5A CN106227531B (en) 2016-07-21 2016-07-21 A method of realizing mother tongue programming on computers

Country Status (1)

Country Link
CN (1) CN106227531B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101174207A (en) * 2007-11-05 2008-05-07 马旭东 System and method for developing multiple high-level language programs using mother tongue
CN102479078A (en) * 2010-11-26 2012-05-30 苗玉水 Chinese programming method for computer by using Chinese phonetic codes

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8020145B2 (en) * 2005-08-18 2011-09-13 Wave Semiconductor Method and language for process expression

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101174207A (en) * 2007-11-05 2008-05-07 马旭东 System and method for developing multiple high-level language programs using mother tongue
CN102479078A (en) * 2010-11-26 2012-05-30 苗玉水 Chinese programming method for computer by using Chinese phonetic codes

Also Published As

Publication number Publication date
CN106227531A (en) 2016-12-14

Similar Documents

Publication Publication Date Title
Cunningham GATE, a general architecture for text engineering
Overmyer et al. Conceptual modeling through linguistic analysis using LIDA
Wohlgemuth A typology of verbal borrowings
Beesley et al. Finite-state morphology: Xerox tools and techniques
Crockford Javascript: the good parts: the good parts
KR101098718B1 (en) System and method for creating, managing and using code segments
Cassidy et al. Multi-level annotation in the Emu speech database management system
Zhang et al. HHMM-based Chinese lexical analyzer ICTCLAS
CN1159661C (en) System for Chinese tokenization and named entity recognition
Johnston From archive to corpus: Transcription and annotation in the creation of signed language corpora
Oostdijk et al. The construction of a 500-million-word reference corpus of contemporary written Dutch
US8670975B2 (en) Adaptive pattern learning for bilingual data mining
Pasha et al. Madamira: A fast, comprehensive tool for morphological analysis and disambiguation of arabic.
US20060004725A1 (en) Automatic generation of a search engine for a structured document
US7383169B1 (en) Method and system for compiling a lexical knowledge base
US20070168909A1 (en) System And Method For Context-Sensitive Help In A Design Environment
CN100371927C (en) Method and system for identifying paraphrases using machine translation techniques
KR100650427B1 (en) Integrated development tool for building a natural language understanding application
US9720944B2 (en) Method for facet searching and search suggestions
Horstmann Object-oriented design and patterns
Ginsburg et al. A mathematical model of transformational grammars
WO2001001390A1 (en) Electronic document processor
Carley et al. Automap user's guide 2012
Lindén et al. Hfst—framework for compiling and applying morphologies
US20130185049A1 (en) Predicting Pronouns for Pro-Drop Style Languages for Natural Language Translation

Legal Events

Date Code Title Description
C06 Publication
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
GR01 Patent grant