ECMAScript仕様輪読会 #8
前回: ECMAScript仕様輪読会 #7
Scrapboxの招待リンク: https://scrapbox.io/projects/esspec/invitations/85b96c9fa718ce5185e307196ed8fb53
connpass: https://esspec.connpass.com/
Discord: https://discord.gg/59S3y6weQj
Twitter hashtag: #esspec
https://www.youtube.com/watch?v=TCyedi93Kcc
自己紹介 (近況報告)
syumai
Twitter: https://twitter.com/__syumai GitHub: https://github.com/syumai
GoとTSやってます
今週ネスペと、Go Conferenceの登壇録画締め切りです
色々と厳しいけど頑張ります
Jun Yasumura / harupiyo Jun Yasumura.icon
https://twitter.com/harupiyo
HTML5.0の仕様書を読んだ経験あり
講師。HTML/CSSコーダーにGit、Svelte、Storybook、Chromatic、Playwrightを伝えて開発チームを幸せにすることが今の目標。教科書作成中。
輪読会は英語の勉強にも役立っています。
noyannoyan.icon
就職しました
朝5時まで起きてたので寝不足・・・
yebis0942yebis0942.icon
最近は趣味でクローラーを書いてます
あんまりベストプラクティスわかってない
おーみーaumy.icon
Twitter: aumy_f GitHub: aumyf
首が痛い
cycle.js
朝4時に起きたので眠い…
tars0x9752 (たーず / naoki aoyama)
Project Gemini ちょっと興味あって調べたりしてた
https://en.wikipedia.org/wiki/Gemini_(protocol)
lobste.rsとかでたまに記事上がってるなーという印象ありましたyebis0942.icon
NozomuIkuta
GitHub: https://github.com/NozomuIkuta
Twitter: https://twitter.com/NozomuIkuta
Vue Fes Japan Online 2022 https://vuefes.jp/2022/
Rollup Plugin勉強中
今回の範囲
5.2.1 Abstract Operations から
https://tc39.es/ecma262/
5.2.1 Abstract Operationsg
Abstract Operation
邦訳: 「抽象演算」とか「抽象操作」とか
仕様書の中で何度も使われるアルゴリズムに名前をつけて、パラメータを取る関数のようにしたもの
関数適用形式とメソッド適用形式がある
メソッド適用形式のpolymorphically dispatched ...
レシーバーの型に応じて呼ばれるメソッドの実体が変わる?
そもそも仕様書のalgorithmのレベルに型の概念があるのか?
とりあえず先に進むことにした
"7 Abstract Operations"以下の目次を見ても関数適用形式の定義しかないような気がするyebis0942.icon
(英語) facilitate: 簡単にする
yebis0942.icon"their use"といいつつthemの内容が後から出てきてる気がする。これってありなのか…
aumy.icon In order to~ を後置することもできそうですけどこれそのまま前に持ってこれるんですね
noyan.icon 後置すると、so that ~ と被って論理関係が曖昧になるので、これを避けたのかしら
5.2.2 Syntax-Directed Operations
Syntax-Directed Operation
邦訳: ?
ECMAScript文法の生成規則に紐付いているアルゴリズム
紐付いた生成規則のsymbolを引数のように参照できる
"source text matched by"
ソーステキストのうち、生成規則にマッチした範囲のこと
Step 1-4: Syntax-Directed Operationsの呼び出し方
SomeNonTerminalはParse Node
chain productionは暗黙的に定義を引き継ぐ
「BlockにSyntax-Directed Operationがない」というのはあくまでも説明上の仮定っぽいですね。specには普通に規定されてました…yebis0942.icon
8 Syntax-Directed Operationで具体的な定義を読んでみる
https://tc39.es/ecma262/#sec-syntax-directed-operations
BoundNamesの定義を読んでみる
「この生成規則に当てはまるときはこのアルゴリズムでBoundNamesが求まる」という定義になっている
この定義の中にBoundNamesへの参照が出てくるけども…?
定義を再帰的に適用していくと最終的には具体的な値を得るステップに到達できそう
algorithm stepの中でthe BoundNames of BindingListのように書くと
「BindingListを引数としてBoundNamesを実行した結果」を意味する
IsConstantDeclarationの定義を読んでみる
Parse Nodeの定義を再確認する
IsConstantDeclarationの定義を読んでて出た疑問
letとかはParse Nodeになるのか?
https://tc39.es/ecma262/#sec-syntactic-grammar の定義によるとなりそう
symbol: terminal symbolとnon-terminal symbol
letとかconstはsymbolのひとつ
IsConstantDeclarationに定義に出てくる$ \tt\bold{{let}}ってどういう意味だっけ
区切りがコロン1つなのでsyntactic grammar
grammar notationでは太字等幅フォントは"to appear in a source text exactly as written"
→ソースコード中に現れるlet
Syntax-Directed Operationsの解説記事があれば読みたい
V8 Blog: Understanding the ECMAScript spec, part 3
define the following syntax-directed rule:
これはSyntax-Directed Operationではなさそう
(英語) derived from itのitは何?
"the source text matched by ..."
(英語) "A or B"が主語のときは単数?
単数らしい
(英語) Unless explicitly specified otherwise
otherwiseは無視して訳してよさそう
たぶん前の段落でexplicitly specifiedの逆のことを言っているのであろう
5.2.3 Runtime Semantics
Runtime Semanticsはabstract operationまたはsyntax-directed operationによって定義される
5.2.4までシュッと読み流した
5.2.4 Static Semantics
文脈自由文法はECMAScriptを表現するには十分な表現力がない
明記されてないけどEarly Errorとかの話っぽい
cf. カバー文法
(英語) prose requirement: 自然言語で表記された要件、みたいな意味っぽい
prose: 散文
(英語) 第一文のmayは許可
Named Static Semantic Rules are associated with grammar productions and a production that has multiple alternative definitions will typically have for each alternative a distinct algorithm for each applicable named static semantic rule.
ここの訳が難しいね、ということで次回に続く
Named Static Semantic Rules are associated with grammar productions
and
(a production that has multiple alternative definitions) will typically have (for each alternative) a distinct algorithm (for each applicable named static semantic rule).
という感じの構造なのか?しかしfor eachやalternativeの解釈がよくわからないという雰囲気yebis0942.icon