プリンキピア

第7章高水準プログラミング言語

C#C#
In 2000, Microsoft announced C# would be its flagship language. It also has the same fundamental syntax as C++ and Java. However, it is purposed to support Windows applications by closely tying in with Microsoft’s net framework, but it can also be used on Linux and macOS. Net C# is a multi-language, component-based software development tool designed to play nicely with all of the .Net languages including C#, Visual Basic.Net, and Managed C++.
英語のヒント
2000年、Microsoftは、C#を主力言語にすると発表した。C#も、C++やJavaと同じ基本構文を持つ。ただし、Microsoftのnetフレームワークと密接に結び付き、Windowsアプリケーションを支えることを目的としている。LinuxやmacOSでも使える。Net C#は、C#、Visual Basic.Net、Managed C++を含む、すべての.Net言語とうまく連携するよう設計された、多言語対応で、部品を組み合わせる方式のソフトウェア開発ツールである。
INDUSTRY SPOTLIGHT産業の現場から
HLLs in Industry産業におけるHLL
HLLs are important in every industry. One example is Python. Part of its purpose is to support data analytics to process complex data, a major focus of many industries today. It does this with built-in analytics tools in its API which can process raw data and produce information and graphics that can be used to make business decisions. For example, a company interested in generating a graphical representation of its products’ sales across various regions during the past year may use Python data analytics and plotting libraries.
英語のヒント
HLLは、どの産業でも重要である。一例はPythonで、その目的の一つは、多くの産業が今日重視する、複雑なデータを扱うデータ分析を支えることである。APIに組み込まれた分析ツールによって、生のデータを処理し、事業の意思決定に使える情報や図を作る。たとえば、過去1年間の製品売上を、地域ごとに図で表したい企業は、Pythonのデータ分析や作図のライブラリーを使える。
Can you elaborate on how useful it will be to know about HLLs in an industry of your choice (e.g., finance, gaming, travel)? Hint: Think about industries which tend to specialize in specific areas.
英語のヒント
自分で選んだ産業、たとえば金融、ゲーム、旅行などで、HLLの知識がどれほど役立つか、詳しく述べられるだろうか。ヒント:特定の分野へ専門化する傾向のある産業を考えよう。
Logic-Based Languages論理に基づく言語
Logic-based programming languages are those which incorporate a syntax to represent facts and rules about approaches to problems. They have been used to support rule-based approaches as part of the development of artificial intelligence (AI), the simulation of human intelligence by machines such as computers.
英語のヒント
論理に基づくプログラミング言語は、問題への取り組み方に関する事実や規則を表す構文を備える言語である。コンピューターなどの機械による人間の知能の模倣である、人工知能(AI)の開発の一環として、規則に基づく方法を支えるために使われてきた。
The most common language for logic-based programming is Prolog. It is used for both AI and linguistics programming. It is actually an older HLL first developed in 1972 and has stayed with us, receiving extensive updating as AI developed. Figure 7.6 illustrates on the left side how facts and rules can be specified in Prolog. The query window on the right side illustrates how the Prolog fact database can be queried to leverage available rules.
英語のヒント
論理に基づくプログラミングで最も一般的な言語は、Prologである。AIと、言語学に関するプログラミングの両方で使う。実際には、1972年に最初に開発された古いHLLであり、AIの発展に伴って大きく更新されながら、使われ続けてきた。図7.6の左側は、Prologで事実や規則をどう指定するかを示す。右側の問い合わせウィンドウは、利用可能な規則を活用して、Prologの事実データベースへどう問い合わせるかを示す。
Figure 7.6

attribution: Copyright Rice University, OpenStax, under CC BY 4.0 license · CC BY 4.0 · Source出典

Figure 7.6 This sample program and query show the details of how to use Prolog. (attribution: Copyright Rice University, OpenStax, under CC BY 4.0 license)
図7.6 このサンプルプログラムと問い合わせは、Prologの使い方の詳細を示す。(出典:著作権 Rice University、OpenStax。CC BY 4.0ライセンス)

The Implementation of HLLsHLLの実装

All computer languages can be grouped into particular categories. These are based upon support for certain programming paradigms (standards, perspectives, or sets of ideas that may be used to describe the structure and methodologies of an HLL). These paradigms include imperative/procedural, logical, functional, object-oriented, event-driven (the behavior of programs is controlled by actions (events) which are listened for and then acted upon or handled), and parallel programming (dividing a program into concurrent processes). Our modern HLLs are almost always hybrid combinations of these. We will learn about this in more detail in the following subsections of this chapter.
英語のヒント
すべてのコンピューター言語は、特定のカテゴリーに分類できる。分類は、どのプログラミングパラダイムに対応するかに基づく。パラダイムとは、HLLの構造や方法論を説明するための、標準、見方、考え方の集合である。パラダイムには、命令型・手続き型、論理型、関数型、オブジェクト指向、イベント駆動型、並列プログラミングがある。イベント駆動型では、動作、つまりイベントを待ち受け、それに応じて処理することで、プログラムの振る舞いを制御する。並列プログラミングでは、プログラムを並行したプロセスへ分ける。現代のHLLは、ほぼ常に、これらを組み合わせたものである。この章の以下の小節で、さらに詳しく学ぶ。
Imperative/Procedural Programming命令型・手続き型プログラミング
As we have discussed, imperative HLLs take the “tell the computer what to do” approach. This approach is different from that of declarative HLLs that tell a program to obtain information without prescribing how the program should go about doing it. Declarative languages are used to interact with systems that are programmed to figure out these details. An example of a declarative language is Structured Query Language (SQL), which is used to specify a query that a database system can process to store or retrieve data. Imperative languages typically focus on evaluating expressions and storing results in variables. There are other shared features of these languages, such as iteration (looping or repetition).
英語のヒント
説明したように、命令型HLLは、「何をするかをコンピューターへ指示する」方法を取る。これに対し、宣言型HLLは、どう実行すべきかを指定せずに、情報を得るようプログラムへ指示する。宣言型言語は、これらの細部を自ら判断するようプログラムされたシステムと、やり取りするために使う。宣言型言語の例は、構造化問い合わせ言語(SQL)である。データベースシステムがデータを保存・取得するために処理できる、問い合わせを指定する。命令型言語は、通常、式を評価し、その結果を変数へ保存することに重点を置く。反復、つまりループや繰り返しなど、ほかにも共通の機能がある。
Procedural languages extend the imperative paradigm. They make use of procedure calls to change the flow of control. A procedure (function) can be called from anywhere in a program to have it perform a particular job. Some of the languages that support this paradigm are Fortran, COBOL, Pascal, Visual Basic, Ada, C, C++, and C#. Scripting languages, including Python, JavaScript, and PHP, may also be of this type.
英語のヒント
手続き型言語は、命令型のパラダイムを拡張する。手続き呼び出しによって、制御の流れを変える。手続き、つまり関数は、プログラム内のどこからでも呼び出して、特定の仕事を行わせられる。このパラダイムに対応する言語には、Fortran、COBOL、Pascal、Visual Basic、Ada、C、C++、C#などがある。Python、JavaScript、PHPなどのスクリプト言語も、この種類に含まれる場合がある。
Event-Driven Programmingイベント駆動型プログラミング
Most imperative languages also embrace event-driven programming. This paradigm allows the generation of events (for example, as a user clicks on a button). In general, computer operating systems constantly process events of various types that result from interaction with users or are generated by application programs or computer hardware. In event-driven programming, a program is told to listen for selected events, such as the single-click on a particular object (e.g., a button on a UI). The programmer establishes an event handler to deal with the event whenever it is triggered.
英語のヒント
命令型言語の大半は、イベント駆動型プログラミングにも対応する。このパラダイムは、たとえば利用者がボタンをクリックしたときの、イベントの生成を扱えるようにする。一般に、OSは、利用者とのやり取りから生じるものや、アプリケーション、ハードウェアが生成するものなど、さまざまな種類のイベントを絶えず処理する。イベント駆動型プログラミングでは、UIのボタンなど、特定の対象のシングルクリックといった、選んだイベントを待ち受けるようプログラムへ指示する。プログラマーは、イベントが発生するたびに対処する、イベントハンドラーを設定する。