deer-develop / study

2 stars 0 forks source link

10장 #33

Open myeongjae-kim opened 5 months ago

myeongjae-kim commented 5 months ago

“Thus, while most programmers don’t develop compilers in their regular jobs, many programmers have to parse and manipulate texts and data sets of complex and varying structures. These tasks can be done efficiently and elegantly using the algorithms and techniques described in this chapter.”


image

Figure 10.3 A subset of the Jack language grammar, and Jack code segments that are either accepted or rejected by the grammar.

타입스크립트에서도 비슷하게 해볼 수 있을듯

타입 레벨 html parser: https://github.com/microsoft/TypeScript/pull/40336?from=groupmessage#issuecomment-686982530

A grammar is written in a meta-language: a language describing a language.

가장 유명한건 BNF form: https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form


"looking ahead one token suffices to resolve, without ambiguity, which rule to use next. Grammars that have this lingual property are called LL (1). These grammars can be handled simply and elegantly by recursive descent algorithms, without backtracking."

앞에 뭐가 나왔는지 하나만 보면 된다. 많이 봐야할수록 복잡해짐


과제 환경 셋업