Semantic Analysis and Attribute Grammars

박종욱·2021년 12월 4일
0

programing language

목록 보기
5/5

Attribute grammars

  1. Attribute grammars
    Extend CFG with attribute and semantic rules instead of using LBA and CSG which are inefficient for use
    Each attribute is attached to the grammar symbols
    Two notations for associating semantic rules to productions
    ◼ Syntax Directed Definition (SDD)
    ◼ Translation Schemes

  2. Syntax-directed definition(SDD)
    각 grammar symbol이 synthesized나 inherited
    attributes를 가지고 있는 context free grammar의 일반화

  3. synthesized

  4. inherited

  5. L-attributed grammars
    attribute grammars의 일종으로 attributes가 evaluation이 AST의 left-to-right traversal로 이루어진다.(DFS order로 evaluate됨)
    top-down parsing 에 적합

  6. Translation Schemes
    A translation scheme is a CFG in which attributes are associated with the grammar symbols and semantic actions enclosed between { }'s and inserted within the RHS of productions.
    semantic action이 {}사이에 들어있고, RHS of production
    intermediate representation를 만들 때 씀

https://arings.tistory.com/entry/%EC%BB%B4%ED%8C%8C%EC%9D%BC%EB%9F%AC

profile
반갑습니다.!!! :)

0개의 댓글