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
Syntax-directed definition(SDD)
각 grammar symbol이 synthesized나 inherited
attributes를 가지고 있는 context free grammar의 일반화
synthesized
inherited
L-attributed grammars
attribute grammars의 일종으로 attributes가 evaluation이 AST의 left-to-right traversal로 이루어진다.(DFS order로 evaluate됨)
top-down parsing 에 적합
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