Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 1/Identifiers/ja: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Basic Pascal Tutorial/Chapter 1/Identifiers/ja

OldNewLine
1+1B - 識別子 (著者: Tao Yue, 状態: 修正あり)
2+
3+識別子とは保存された値、たとえば変数や定数を参照するための名前である。また、プログラムも識別子によって識別されなくてはならない。
4+
5+識別子の規則:
6+
7+`   英語のアルファベットかアンダースコア(_)の文字ではじまらなくてはならない。`\
8+`   その後にはアルファベット・数字、あるいはアンダースコア(_)を続けることができる。`\
9+`   以下のような特殊記号は含めてはならない。 `
10+
11+`` ~ ! @ # $ % ^ & * ( ) + ` - = { } [ ] : " ; ' < > ? , . / | \ ``
12+
13+目次 \[hide\]
14+
15+`   1 予約語`\
16+`       1.1 Turbo Pascal の予約語`\
17+`       1.2 Delphi の予約語`\
18+`       1.3 Free Pascal の予約語`
19+
20+## 予約語
21+
22+識別子の中には Pascal で予約されており、自分の識別子として利用できないものがある。FPC のリファレンスによれば、それらは次のようにグループ化される。
23+
24+`   Turbo Pascal の予約語`\
25+`   Delphi の予約語`\
26+`   FPC の予約語 `
27+
28+## Turbo Pascal の予約語
29+
30+| | | | | | | | |
31+|----|----|----|----|----|----|----|----|
32+| absolute | and | array | asm | begin | break | case | const |
33+| constructor | continue | destructor | div | do | downto | else | end |
34+| file | for | function | goto | if | implementation | in | inherited |
35+| inline | interface | label | mod | nil | not | object | of |
36+| on | operator | or | packed | procedure | program | record | reintroduce |
37+| repeat | self | set | shl | shr | string | then | to |
38+| type | unit | until | uses | var | while | with | xor |
39+
40+## Delphi の予約語
41+
42+The Delphi (II) の予約語は Pascal の予約語と同じものに加えて以下のものである。
43+
44+| | | | | | | |
45+|-----|---------|--------|----------|--------------|-----------|----------------|
46+| as | class | except | exports | finalization | finally | initialization |
47+| is | library | on | property | raise | threadvar | try |
48+
49+## Free Pascal の予約語
50+
51+Turbo Pascal と Delphi の予約語に、Free Pascal はまた予約語として以下のものを含む。
52+
53+| | | | | |
54+|---------|------|-------|-----|------|
55+| dispose | exit | false | new | true |
56+
57+また、Pascal には事前に定義された識別子がある。それらを自分自身の定義と置き換えることはできるが、 Pascal の機能の一部は除かれてしまう。
58+
59+| | | | | | | | |
60+|-------|-------------|---------|---------|------|---------|--------|------|
61+| abs | arctan | boolean | char | cos | dispose | eof | eoln |
62+| exp | false | input | integer | ln | maxint | new | odd |
63+| ord | output | pack | page | pred | read | readln | real |
64+| reset | rewrite | round | sin | sqr | sqrt | succ | text |
65+| true | trunc write | writeln | | | | | |
66+
67+Pascal は大文字、小文字を区別しない! MyProgram、MYPROGRAM と mYpRoGrAm は同じになる。しかし、可読性を上げるために意味があるように大文字を使用した方がよいだろう!
68+
69+識別子はどんな長さでもよいが、多くの Pascal コンパイラは最初の32文字(あるいはそれぐらい)だけを見る。つまり、以下の2つは、32文字以降しか違わないので Pascal コンパイラには同じものと見なされるかもしれない。
70+
71+`   ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFAlphaBeta`\
72+`   ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGammaDelta`
73+
74+すべてのコンパイラで互換性を持たせるためには識別子は無理のない長さ、せいぜい15文字までにした方がよい。そうすることでタイプする手間も省けるだろう。
75+
76+| | | |
77+|----|----|----|
78+| [[Basic Pascal Tutorial/Chapter 1/Program Structure/ja|previous]] | [[Basic Pascal Tutorial/Contents/ja|contents]] | [[Basic Pascal Tutorial/Chapter 1/Constants/ja|next]] |
79+
80+---
81+*From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 1/Identifiers/ja", as it stood on 2022-08-20 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history