holy shift
play

HOLY SHIFT! Linda Zheng Roadmap You are here My Shift - PowerPoint PPT Presentation

HOLY SHIFT! Linda Zheng Roadmap You are here My Shift Introduction Shift AST Experience Overview with Shift What is the Shift Project? Abstract Syntax Tree (AST) Binary Expression Identifier Identifier PLUS a + b a b


  1. HOLY SHIFT! Linda Zheng

  2. Roadmap You are here My Shift Introduction Shift AST Experience Overview with Shift

  3. What is the Shift Project?

  4. Abstract Syntax Tree (AST) Binary Expression Identifier Identifier PLUS a + b “a” “b”

  5. Shift Parser

  6. The Shift AST ● ~100 nodes ● Full support for ES6 features ● Complies with ECMAScript Standard

  7. Example Use Case ● So much JS code… ● So much math... ● Uh oh... ● Replace all “+” with “*”

  8. Text Find-and-Replace Problems // ToDo: replace “+” with “*” // ToDo: replace “*” with “*”

  9. Text Find-and-Replace Problems for (i = 0; i < 10; i++) { … } for (i = 0; i < 10; i**) { … }

  10. Text Find-and-Replace Problems var pattern = /a+/ var pattern = /a*/

  11. Solution with Shift AST Binary Expression Identifier Identifier PLUS MUL Expression Expression “a” “b”

  12. Next Step: Code Generator

  13. Where Shift AST Shines ● Transformations ● Analysis

  14. Roadmap (again) You are here My Shift Introduction Shift AST Experience Overview with Shift

  15. Contributions to Shift ● Generate Shift AST nodes ● Parser ● Reducer (single state) ● Code Generator ● Fuzzer ● AST Validator ● Serializer / Deserializer

  16. Node Expression Statement “orphans” ➢ LiteralNumeric ➢ If ➢ BindingIdentifier ➢ Array ➢ ForIn ➢ FunctionBody StaticMember Break ClassDeclaration ➢ ➢ ➢ Binary TryCatchFinally Super ➢ ➢ ➢ ➢ LiteralString ➢ Return ➢ Script ➢ This ➢ Block ➢ Module … … … ➢ ➢ ➢

  17. Function Class Function Function Class Class Declaration Expression Declaration Expression Expression Super Expression Super

  18. ParseObject “{“ ObjectExpression ObjectBinding Has “=” “({x, y})” “({x, y}=0)” (Expression (Orphans Transform Destructuring Family) Family) No “=” Return Return Expression Binding Either <Expression, Binding>

  19. ParseArray “[“ ArrayExpression ArrayBinding Has “=” “[x, y]” “[x, y]=0” (Expression (Orphans Transform Destructuring Family) Family) No “=” Return Return Expression Binding Either <Expression, Binding>

  20. Roadmap (final) You are here!!! My Shift Introduction Shift AST Experience Overview with Shift

  21. Check out these Links! Shift Website http://shift-ast.org/ Shape Github Repo https://github.com/shapesecurity

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend