Andwhenitcomestoprogramming, I reallyliketodivedeeplyintostuffwhicharetrivial, sotrivialthatit's partofourdailyroutineandwejustoverlookit, Um, andbecauseit's somethingsotrivial, then I'm gonnadivedeeplyintoit, andnaturally, it's gonnabe a littleof a leveltalk, soit's notgonnaturnyounecessarilyintobetterreactorangulardevelopers.
Butattheendoftheday, you'llbeabletosolveproblemsthat a lotofprogrammersdon't knowhowtosolve, andjust a newworldofpossibilitieswillopenuptoyou.
Andthesubjectofthedayis a otcompilersaheadoftime.
So I assumethatyou'reprettymuchfamiliarwiththeconcept.
Okay.
Examplecompilerscompilersfor C or C plusPlus, whereyoubasicallytake a coatstringandyougetitfromoneformatsintonativemachinecode.
Andthere's a lotofadvantagestothat, becauseonceyouknowhowitactuallyworks, thenyouwouldknowhowtorunsomeprocessingbeforeyouactuallygototheinterpreterratherthanracewastingsomeruntimeprocessingpower.
I'm notgonnagothroughitbecausethisisveryboring, but I thinkwegottheprincipaloncewesawbecauseofwhatwesawonHonestyExplorer.
Nowthesecondstage.
Oncewehave a nastyweputitbackintocode.
Thisstageiscalledgenerating, so I'llgotoBabel's documentationwebsiteagainandwewilllookatthelibrarycalledGenerator.
Soagain, verysimple.
A p I wesimplyacceptNASDasthefirstargumenttheoutputshouldbecoatandagain I wouldliketodemonstratethatveryquickly.
Okay, good.
Soinadditiontowhat I didearlierNo, I havethegeneratefunctionandonce I importit, I providedwith a generated A S T and I printedtotheconsoleandtheoutputshouldbeexactlythesame.
Itgoestotherootknoweditgoesdeepertoprogram, verbalthecollisionandthenonceitsees a transformationcoldbackthenitgoestothecallback, appliesthelogicandthenitkeepswalkingthroughthetree.
IfwelookatBabel, Babel's documentationwebsite, there's a librarycalledBabelTraverseandTraversedoes.
Exactlywhat I saidisthefirstargument.
ItacceptsNASDasthesecondargument.
Itacceptsanobjectwhichiscalled a visitor, becausethisobjectvisitstheASDaswewalkthroughit, andthisobjectcontainscallbacks.
Therefore, safesomeerrorssecondandfinal, pluggingthat I wrotesomethingforstylecomponentsratherthancreating a dedicatedcomponentpaireachcomponentthatyouwouldliketoencapsulatedstyle.
Youcanuse a singlestyleshitcomponentanduseunderscoretoencapsulateprivateclassnames.