Year | Price($) | Product |
---|---|---|
1958 | ー | ALGOL (大学で遊んでいました。 I was playing in college) |
1964 | 2,368 | Ford Mustang (高校生のナンパ車として購入されました。 It was purchased as a pick-up car for high school students) |
1976 | 776 | ワンボードマイコン TK-80 (¥89k 給料1ヶ月分) (One board microcomputer) |
1972 | 395 | (¥45k) HP-35 関数電卓 (Scientific calculator, RPN: 逆ポーランド記法) |
1976 | 115 | 電子ブロック(復刻版) (Electronic block(Reprint)) |
1976 | 666.66 | Apple I (ガレージで製造された初号機です。 The first machine manufactured in the garage) |
1978 | ー | UCSD Pascal (ALGOLの後継言語で p-code
インタプリタで動作します。憧れてマクロアセンブラで構造化命令、空白圧縮するエディタを作りました。後に新聞社からオファーが来ました) (It works with the p-code interpreter in the successor language of ALGOL. I longed to make a structured instruction and blank compression editor with a macro assembler. Later, an offer came from a newspaper company) |
1979 | 4,526 | Apple II (衝撃的な マイコン、価格も Ford Mustang の倍です。 A shocking microcomputer. Double the price of the Ford Mustang) |
1983 | 456 | MSX 初めて購入したマイコン。(The first microcomputer I bought) |
2010 | 6 | AWK˜plus for Java, Android |
2020 | 500 | PlayStation 5 |
2021 | 27 | (¥3k) AWK˜plus for Android II (Source code edition: $146,¥16k, 2 days worth of part-time job) |
BNF 記法は、ALGOLの仕様定義用に開発されたツールですが、正規表現を使用した実装は、yacc/lex (コンパイラ・コンパイラ、bison) 以来久しぶりの登場です。
BNF is a tool developed for ALGOL's specification definition, but the implementation using regular expressions
hasn't appeared in a long time since yacc/lex (compiler/compiler).
Token | Definition | |
---|---|---|
WORD (ANY) | ::= | </.+/> (※ 単一ワードもしくはクォートされた文字列。 Single word or quoted string. *) |
MANY | ::= | </.../> (※ '...' is the UTF-8 symbol. *) |
PARENTHESES | ::= | </(...)/> (※ 括弧で囲まれた複数ワード。 (Multiple words in parentheses) *) |
BYTE | ::= | </[-+]?\d{1,3}/> |
NUMBER | ::= | </[-+]?(?:\d+[.]?\d*|\d+[.]|[.]\d+)(?:[eE][-+]?\d+)?/> |
BOOLEAN | ::= | <true | false> |
STRONG_STRING | ::= | </'(.*?)'/> (※ 文字列、変数を置き換えません。(Does not replace variables) *) |
WEAK_STRING | ::= | </"(.*?)"/> (※ 文字列、変数を置き換えます。(Replace variable) *) |
REGEX | ::= | </(.+?)/> (※ 正規表現、変数を置き換えます。(It's a regular expression, Replace variable) *) |
AWK_COMMAND | ::= | </`(.+)`/> (※ AWK スクリプトコマンド、変数を置き換えます。(AWK script command, Replace variable) *) |
VAR | ::= | </\w+/> (※ 変数。(Variable) *) |
INDEX | ::= | <a[n] | a[n1-n2] | a[-n] | a[n-] | a[*] | a[-]> (※ (n: 1...size,
n1 <= n2) csh の '-' の使い方には感心しましたが、[*] は統一性に欠けているため [-](all) を追加しました。 (I was impressed with how csh uses '-', but I added [-] because [*](all) is inconsistent) *) |
ARRAY | ::= | </VAR(?:\[<INDEX>\])?/> |
CONTAINER | ::= | <STACK | QUEUE> |
RANGE | ::= | <`range(start,end[,incremental])`> (※ 開始、終了、増分を指定して数列を生成します。 (Generate a sequence by specifying start, end, and increment) *) |
WORD_LIST | ::= | < ( ARRAY | CONTAINER | RANGE | stdout | stderr | &WORD...) > (※ &サイレントモード: ログ表示を抑えるために単純変数に限り、$var の代わりに &var 指定が可能。 &Silent mode: Only simple variables can be specified as &var instead of $var to suppress log display. *) |
ARITHMETIC_OPERATOR | ::= | 算術演算子 </(?:[-+*/%&|^]|<<|>>)=?|=/> |
LOGICAL_OPERATOR | ::= | 論理演算子 /<BOOLEAN | NUMBER | AWK_COMMAND>/ |
SCRIPT | ::= | </["']?/.+[.](awk|.*sh.*?)/["']?/> |
COMMAND | ::= | <AWK_COMMAND | SCRIPT | BUILTIN_COMMAND> |
EXPRESSION | ::= | <BOOLEAN (BOOLEAN | NUMBER | STRING) | AWK_COMMAND (LOGICAL_OPERATOR)> |
※ Control statement | ||
IF | ::= | <[else] if ( EXPRESSION ) <then | BREAK | CONTINUE | COMMAND> (※ COMMAND 部分が曲者で、真なら COMMAND(制御文は不可) をパースした後に if 文を書き換えます。 (If the COMMAND part is a songwriter and is true, rewrite the if statement after parsing COMMAND (control statements are not allowed) *) |
ELSE | ::= | <else> |
END | ::= | <end> (※ 単一の end は、他のシェルと決定的に異なる部分です。 (A single end is a decisive difference from the others) *) |
FOREACH | ::= | <foreach VAR ( &WORD_LIST )> |
WHILE | ::= | <while ( EXPRESSION )> |
BREAK | ::= | <break> |
CONTINUE | ::= | <continue> |
※ BNF の実装を正規表現で行うことにより、nano パーサーが完成しました。 シンタックスチェッカーは、簡素化され、エラーを投げているだけです。
※ By implementing BNF with regular expressions, the nano parser was completed. The syntax checker has been
simplified and just throwing an error.
|
伏兵登場 (Ambush appeared)
if (`$foo`) then
foreach i (bar) ... end #1 jump to parent ☆nano # <- insert, jump to end-if else if (`$baz`) then ... else ... end #1 の end は、親 (foreach, while) と end-if
へジャンプする必要が有り矛盾しています。そこで最良の方式として、オプティマイザを実装し nano 命令を else の手前に挿入しました。 |
Command | Description |
---|---|
cat file... | (1) Displays the contents of the file. The shortest script '1' in the world. |
csv [-Fs] [-v OFS=s] [-v col=<columns>] [-v fmt="<output formats>"] file... | (17) CSV utility、デリミッタの変更(AWK標準機能)、列の入れ替え、sort の為のフォーマット変換が可能で今まで無かったのが不思議です。 (It is strange that it has never been possible to change the delimiter (AWK standard function), replace columns, and convert the format for sort) |
Eratosthenes <number> | (28) プログラムコンテストで使用したアルゴリズムで、探索する素数の数に制限は有りません。 There is no limit to the number of prime numbers that can be searched by the algorithm used in the program contest. |
grep <regex> [-x <exclude>] file... | (16) Can be extracted and excluded. |
head [-<number of lines>] file... | (8) Outputs the specified number of lines from the beginning of the file. |
sort [-r] [-i] [-u] file... | (40) It has reverse, ignore case, and unique features. |
tac [-<number of lines>] file... | (18) cat の逆順出力。 It works in reverse of 'cat'. |
tee file... | (6) Outputs the stream to standard output and error output. |
wc file... | (19) Word count. |
nano Shell の論理判定は、AWKコマンド(`...`)を使用しますが、nano が解釈できる単純な判定に限り、魔法の呪文を用意しました.
The nano Shell's logical verdict uses the AWK command (`...`), but i've provided a magic spell for simple
verdicts that nano can interpret.
Before(AWK) | After(Magic spell) | Explanation |
---|---|---|
`!$a` | `(?:!$a)` | `(?:!($a))` | 単一の論理判定を行う。 (Make a single logical decision) (※ TRUE ::= true | !=0 | Non-empty string is true *) |
`$b<=$c` | `(?:$b<=$c)` | `(?:!($b>$c))` | 二つの値を比較する。(Compare the two values) (※ LOGICAL_OP ::= /([<>!]=?)|==/ *) |
`length(s)` | `(?:length(s))` | 文字列 s の長さを返す。 (Returns the length of the string s) |
`substr(s,i[,n])` | `(?:substr(s,i[,n]))` | 文字列 s の i(1...) 番目から始まる n 文字を返す。 (Returns n characters starting from the i of the string s) |
`match(s,regex)` | `(?:match(s,regex))` | regex が s に適合する位置(1...)を、適合しない場合は、0 (false) を返す。 (Returns the position (1...) where regex matches s, 0 if it does not) |
ー | `(?:range(s,e[,i]))` | `range(s,e[,i])` | 開始、終了 [、増分]を指定して数列を生成する。 (Generate a sequence by specifying start, end, and increment) |
Constant | Explanation |
---|---|
infinite | -infinite | Maximum and minimum integers (※ Cannot be used for range *) |
0:silence | 1:error | 2:warning | 3:information | 4:verbose | Message level |
true | false | Logical value |
Variable | Explanation |
---|---|
$BASE | App ストレージパス "../$HOME" (APP storage path) |
$FS | フィールドセパレータ、 初期値は、" " で /[ \t]+/ の意味。 (AWK 仕様) Field Separator, The initial value is " ", which means /[\ t]+/. (AWK specifications) |
$HOME ("~/") | App home path "$BASE/AWK~plus" e.g. "$HOME/foo/bar" or "~/foo/bar" |
$NULL | null value (Ref. Built-in commands#pop) |
※ 環境変数は、親子シェルで変数共有するために使用します。
(Environment variables are used to share variables in the parent-child shell)
export VAR = var を使用すると、コンテナ(配列、スタック、キュー)の共有が可能です。
(Container (arrays, stacks, queues) can be shared) (Ref. AWK˜nano T.ENV.bsh)
※ 同名のローカル変数が存在する場合は、ローカル変数を削除しエラーメッセージを出力します。
(If a local variable with the same name exists, the local variable is deleted and an error message
is output)
export, printenv,
※ 環境変数の更新が可能なコマンドは、以下の通り(配列要素への代入をサポートしているコマンド)です。
(The commands that can update environment variables are as follows (commands that support
assignment to array element)
copy, pop, replace, set (1), set (2)
※ 変数の命名規約のガイドラインは下記のスタイルを提案します。
(Variable naming convention guidelines suggest the following styles)
e.g. FIXED_VALUE, variableValue (Java style),
VariableValue (C style)
Variable | Explanation |
---|---|
$1...n | 子スクリプトに渡される argv。 (Argument vector passed to child shell script) |
$argv[n] | 同上 (Same as above) |
$messageLevel | Message level (Passed from parent to child) |
$status | Exit status of the last exit command |
$systime | Returns the current time (ms.) |
stdout, stderr | Standard output, error (※ これらは、生データのため次のコマンドで利用します。 (These are raw data and will be used in the following command) *) foreach, set(3), push(1), copy, split |
Value | Example | Explanation |
---|---|---|
<file> | file | ファイル名が重複していない場合は、これを使用します。 (Use this if the filename is unique) ※ この方式は、フォルダアクセスするため負荷が高いがキャッシュ化によりパフォーマンス向上 (10倍) しました。 (This method has a high load due to folder access, but performance has improved (10 times) due to caching.) |
$HOME | $HOME/foo/bar/file | home を展開します。 (Expand home) |
~/ | ~/foo/bar/file | 同上(チルダ展開)。 (Same as above) |
*/ | */bar/file | 後方一致で展開します。 (Expands with a suffix match) |
※ こうして言語作りの集大成となる『気になる』アプリ、メジャー入りを狙ったアプリが完成しました。
※ In this way, the "worrisome" app, which is the culmination of language creation,
and the app aimed at entering the major were completed.