What Are the Different Types of Grammar Programs?

An interpreter is a language processing program that works basically the same as a compiler in terms of lexical, grammatical, and semantic analysis, but when a user program is run, it directly executes the source program or the internal form (middle code) of the source program. The universal interpreter refers to an interpreter that can run on multiple platforms or a system program that can perform processing while interpreting statements of multiple high-level language source programs. Therefore, a universal interpreter can also be called a portable interpreter. The former such as the interpreter of the Java language can be run on different platforms. For a universal interpreter, the size of the troubleshooting capability is one of the important indicators to evaluate its performance.

A translation program that is interpreted sentence by sentence in accordance with the dynamic execution order of source program statements and then executed immediately. The interpreter mainly includes lexical analysis, general control program, and a set of execution routines for various types of statements. The general control program controls its execution. The general control program completes the syntax check of sentences, discriminates different sentences, and transfers tasks such as executing subroutines accordingly. An error message is output when the syntax is wrong. The execution subroutine performs the corresponding action according to the semantics of the statement. The interpreter does not produce the target program. Usually, it takes more machine time than compiling the program, but it takes less storage space. The general structure of the interpreter can be divided into two main modules: an interpreter module and an operation module. The former's function is to input sentences one by one according to the dynamic execution order of the source program, and analyze and explain a single sentence, including checking the correctness of syntax and semantics, generating equivalent intermediate code or machine language code, and providing error information processing. The latter function is to run the translated code of the statement and output the intermediate or final result. Due to the different design ideas of the interpreter, the execution mode of the operation module is also different. One way is to interpret the module directly to generate machine language code equivalent to the source program statement; usually one statement generates multiple machine instruction code segments. The run module is responsible for controlling the execution of this code and processing the intermediate results (save or output). Another way is to interpret the module to generate the equivalent intermediate code (but not the machine language code), such as the program call and its parameter form. The operation module is responsible for selecting the corresponding functional part and controlling the execution of the intermediate code, and processing the relevant operation results [1]
Java interpreter is a translation program used to interpret Java program statements. Java is a simple, object-oriented, programming language for network environments. The basic characteristics of the Java language are: simple and easy to learn, object-oriented, suitable for network distributed environments, interpreted execution and multi-threaded, with a certain degree of security and robustness. Its basic interpreter and support for classes is only about 40 kB, plus standard class libraries and thread support is only about 215 kB, so the system overhead is small and it is suitable for small information processing and information environments. Because it can realize the automatic waste area collection, it also simplifies the memory management of the program design. The Java interpreter is built on the Java virtual machine and can run on a variety of different platforms with good generality.
A program, especially a medium or large-scale program, is inevitably free of errors. Finding and troubleshooting errors in source programs is one of the tasks of a language processing system. Generally, syntax errors and static semantic errors of source programs are discovered by compilers or interpreters. This ability of interpreters is generally called troubleshooting, that is, the ability to find syntax and semantic errors. It is usually found and excluded by adding some troubleshooting facilities such as tracking and truncation to the language.
Portability is one of the elements of software quality. Good portability can prolong the life cycle of software and expand the application environment of software, so it has become a research direction of common concern in the theoretical and engineering fields. The research work on software portability mainly discusses the design and implementation strategies of portability at different levels such as programming languages, compilers, operating systems and computer architectures. Generalized portability involves different aspects of software installation, operation, and matching with relevant standards in a specified environment, which can be broken down into adaptability, easy installation, compatibility, and (easy) replaceability. Adaptability refers to whether the software can adapt to different target environments. Ease of installation refers to the ease with which software can be installed in a given environment. Compatibility refers to whether the software complies with standards or conventions related to portability. (Easy) replaceability refers to whether the software can replace other software under the specified environment and the degree of difficulty of replacement. Narrow portability refers to the adaptability of software to the target environment, which can be broken down into two levels: source code level and executable code level. The former requires the software source code to be recompiled in the target environment, while the latter is the executable code to run the software directly in the target environment [2] .

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?