2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
JSConf attendee!
2018 @phenomnominal
(School of Witchcraft and Wizardry)
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
But there's a problem...
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
(this is 100% canon, don't look it up)
2018 @phenomnominal
2018 @phenomnominal
<~
sss
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
~>
2018 @phenomnominal
2018 @phenomnominal
sssCast
alert
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
(the darkest of the dark arts)
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
(aka transfiguration)
2018 @phenomnominal
"Transpiling is a specific term for taking source code written in one language and transforming into another language that has a similar level of abstraction"
2018 @phenomnominal
String literal
Function call
Identifier
Expression
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
disassociated from any specific instance
the way in which linguistic elements are put together
data structure made up of vertices and edges without any cycles
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
a data structure that represents the structure of code, without any actual syntax.
2018 @phenomnominal
a data structure that represents the structure of code, without any actual syntax.
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
Esprima takes code written in a specific language (JavaScript) and turns it into an AST!
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
"Lexing is the process of breaking down source code into words that are relevant to the language, which are called tokens"
2018 @phenomnominal
Identifier
Keyword
Literal - bool, null, number, string
Punctuator
EOF
RegularExpression
Template
(we're getting a bit intense now - here's an owl)
2018 @phenomnominal
Identifier
Keyword
Literal - bool, null, number, string
Punctuator
EOF
Indent
LineTerminator
Space
(we're getting a bit intense now - here's an owl)
2018 @phenomnominal
Identifier characters
Space
Punctuator characters
Space
Quote character
2018 @phenomnominal
Punctuator
Punctuator
String characters
Quote character
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
"Parsing is the process of taking the lexical tokens and applying the grammar of the language to them"
2018 @phenomnominal
Identifier
Space
Punctuator -
Space
String literal
<~
2018 @phenomnominal
Identifier
Space
Punctuator -
Identifier
Punctuator -
Space
Identifier
Punctuator -
Line Terminator
Indent
[
,
]
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
2018 @phenomnominal
Me: Craig
Twitter: @phenomnominal
Code: github.com/phenomnomnominal/parseltongue
Slides: slides.com/craigspence/fantastic-asts-and-where-to-find-them-jsconf
https://github.com/dannysu/ecmascript1
https://github.com/estree/estree
https://github.com/jquery/esprima
https://github.com/estools/escodegen
http://estools.github.io/esquery
https://medium.com/@kosamari/how-to-be-a-compiler-make-a-compiler-with-javascript-4a8a13d473b4
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API
https://github.com/mozilla/source-map#generating-a-source-map
https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/
https://www.buzzfeed.com/zgalehouse/300-harry-potter-gifsthe-magic-never-ends-7sat
2018 @phenomnominal