Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

最低限実用的に動かすためのやること #1

Open
29 of 36 tasks
slofp opened this issue Nov 23, 2023 · 0 comments
Open
29 of 36 tasks

最低限実用的に動かすためのやること #1

slofp opened this issue Nov 23, 2023 · 0 comments
Labels
project/Lib Ai.js main source issue

Comments

@slofp
Copy link
Owner

slofp commented Nov 23, 2023

なんかあったら順次追加していく

基本方針

  • できそうな文法変換は意地でも実装する。
  • AiScriptの変換だが、Javascriptとの相互互換を取ること

基本動作系

  • 変数宣言 (let identifier = expr, var identifier = expr)
  • 変数代入 (name = v)
  • 四則演算 (1 + 2 - 3 * 4 / 5)
  • 関数定義 (@identifier(args) {})
  • 関数戻り値 (return expr)
  • 関数呼び出し (identifier(args))
  • 演算代入式 (identifier += expr, identifier -= expr)
  • if文 (if (expr) {} elif (expr) {} else {})
  • for文 (for expr {}) #2
  • while(loop)文 (loop {})
  • ブロック文 (eval {})
  • for...of(each)文 (each let e, expr {})
  • ループ制御 (break, continue)
  • オブジェクト参照 (identifier.props)
  • 比較演算 (&&, ||)
  • 括弧 (())

リテラル系

  • num (10.123)
  • bool (true, false)
  • str ('text')
  • null (null)
  • テンプレート文字列 (`text{expr}text`)
  • arr ([el1, el2])
  • obj ({ pr1: expr, pr2: expr })
  • 無名関数(アロー関数) (@(args) {})

AiScript特有動作系

対応しない?AiScript特有動作系

Javascript特有動作系(対応しないもの)

  • async/await構文
  • try/catch構文
  • import/export
  • throw

Javascript特有動作系(対応したいもの)

  • class #16
  • ビット演算子
  • for...in
  • 三項演算子 expr ? expr : expr
  • ジェネレート関数 function*
  • switch文

Javascript特有動作系(未定なもの)

  • デフォルト引数 (function aaa(x = 10) {})
  • 分割代入 ({ a, b } = { a: 10, b: 10 }, [a, b] = [10, 10])
@slofp slofp added the project/Lib Ai.js main source issue label Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project/Lib Ai.js main source issue
Projects
None yet
Development

No branches or pull requests

1 participant