2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
SpEC attendee!
2022 @phenomnominal
(School of Witchcraft and Wizardry)
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
But there's a problem...
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
(this is 100% canon, don't look it up)
2022 @phenomnominal
2022 @phenomnominal
<~
sss
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
~>
2022 @phenomnominal
sssCast
alert
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
(the most evil magic)
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
(aka transfiguration)
2022 @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"
2022 @phenomnominal
String literal
Function call
Identifier
Expression
2022 @phenomnominal
2022 @phenomnominal
2022 @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
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
a data structure that represents the structure of code, without any actual syntax.
2022 @phenomnominal
a data structure that represents the structure of code, without any actual syntax.
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
var spell = 'Expecto Patronum';
function magic (spell, intensity) {
var intense = '';
for (var i = 0; i < intensity, i = i + 1) {
intense = intense + '!';
}
return spell + intense;
}
for (var i = 0; i < 10, i = i + 1) {
magic(spell, i);
}
2022 @phenomnominal
import { parse } from 'esprima';
const AST = parse(`
var spell = 'Expecto Patronum';
function magic (spell, intensity) {
var intense = '';
for (var i = 0; i < intensity, i = i + 1) {
intense = intense + '!';
}
return spell + intense;
}
for (var i = 0; i < 10, i = i + 1) {
magic(spell, i);
}
`);
Esprima takes code written in a specific language (JavaScript) and turns it into an AST!
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
"Lexing is the process of breaking down source code into words that are relevant to the language, which are called tokens"
2022 @phenomnominal
Identifier
Keyword
Literal - bool, null, number, string
Punctuator
EOF
RegularExpression
Template
(we're getting a bit intense now - here's an owl)
2022 @phenomnominal
Identifier
Keyword
Literal - bool, null, number, string
Punctuator
EOF
Indent
LineTerminator
Space
(we're getting a bit intense now - here's an owl)
2022 @phenomnominal
Identifier characters
Space
Punctuator characters
Space
Quote character
Punctuator
Punctuator
String characters
Quote character
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
"Parsing is the process of taking the lexical tokens and applying the grammar of the language to them"
2022 @phenomnominal
Identifier
Space
Punctuator -
Space
String literal
<~
2022 @phenomnominal
Identifier
Space
Punctuator -
Identifier
Punctuator -
Space
Identifier
Punctuator -
Line Terminator
Indent
[
,
]
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal
2022 @phenomnominal