Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHP で AST 解析をして Java のオペコードを生成する

memory
November 22, 2019

PHP で AST 解析をして Java のオペコードを生成する

- Kichijoji.pm in Japan

English Title:
Generates Operation Codes of Java on performed an Abstract Syntax Tree from PHP code.

memory

November 22, 2019
Tweet

More Decks by memory

Other Decks in Programming

Transcript

  1. © - BASE, Inc. Who am I? (@m m r

    ) BASE GameWith PHP, TypeScript
  2. © - BASE, Inc. 1 + 2 + 3 Value

    Label Means Number Whitespace + Plus Whitespace Number Whitespace + Plus Whitespace Number
  3. © - BASE, Inc. PHP Value Label Means T_LNUMBER T_WHITESPACE

    + - ( ) Whitespace T_LNUMBER T_WHITESPACE + - ( ) T_WHITESPACE T_LNUMBER
  4. © - BASE, Inc. PHP AST Echo_ (Stmt) Plus (BinaryOp)

    Plus (BinaryOp) (LNumber) (LNumber) (LNumber) left right left right expressions ( ) (*1) (* ) PHP echo , print ,
  5. © - BASE, Inc. PHP AST Echo_ (Stmt) Plus (BinaryOp)

    Plus (BinaryOp) (LNumber) (LNumber) (LNumber) left right left right expressions ( ) (*1) (* ) PHP echo , print ,
  6. © - BASE, Inc. Java 1 + 2 + 3

    1 2 2 (3 ) 2 (6 ) 3 iconst_ iconst_ iadd iconst_ iadd
  7. © - BASE, Inc. PHP Java Plus (BinaryOp) Plus (BinaryOp)

    (LNumber) (LNumber) (LNumber) left right left right PHP AST
  8. © - BASE, Inc. PHP Java Plus (BinaryOp) Plus (BinaryOp)

    (LNumber) left right left right iconst_ iconst_
  9. © - BASE, Inc. PHP Java Plus (BinaryOp) (LNumber) left

    right iconst_ iconst_ iadd left right
  10. © - BASE, Inc. PHP Java Plus (BinaryOp) left right

    iconst_ iconst_ iadd left right iconst_