(Created page with "{{PRJCompiladoreAvisosEN20202021}} <!--{{PRJCompiladoreAvisosEE20202021}}--> {{PRJCOMandatory20202021}} {{TOCright}} CDK is the basis for compiler development in this setup....") |
(→CDK Nodes) |
||
(16 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
CDK is the basis for compiler development in this setup. Simple is a small compiler based on the CDK. | CDK is the basis for compiler development in this setup. Simple is a small compiler based on the CDK. | ||
− | This page focuses on the nodes, that is, the language elements present in each package. CDK nodes tend to be general, in the sense that the concepts are reusable accross different languages. Simple provides nodes specific to the implemented language. | + | This page focuses on the nodes, that is, the structures defined to represent the various language elements present in each package. CDK nodes tend to be general, in the sense that the concepts are reusable accross different languages. Simple provides nodes specific to the implemented language. |
== CDK Nodes == | == CDK Nodes == | ||
− | * basic_node -- | + | {{CollapsedCode|CDK node hierarchy| |
− | * sequence_node -- | + | <source lang="text"> |
− | * typed_node -- | + | basic_node |
− | + | ├── data_node | |
+ | ├── nil_node | ||
+ | ├── sequence_node | ||
+ | └── typed_node | ||
+ | ├── expression_node | ||
+ | │ ├── assignment_node | ||
+ | │ ├── binary_operation_node | ||
+ | │ │ ├── add_node | ||
+ | │ │ ├── and_node | ||
+ | │ │ ├── div_node | ||
+ | │ │ ├── eq_node | ||
+ | │ │ ├── ge_node | ||
+ | │ │ ├── gt_node | ||
+ | │ │ ├── le_node | ||
+ | │ │ ├── lt_node | ||
+ | │ │ ├── mod_node | ||
+ | │ │ ├── mul_node | ||
+ | │ │ ├── ne_node | ||
+ | │ │ ├── or_node | ||
+ | │ │ └── sub_node | ||
+ | │ ├── literal_node | ||
+ | │ │ ├── double_node | ||
+ | │ │ ├── integer_node | ||
+ | │ │ └── string_node | ||
+ | │ ├── rvalue_node | ||
+ | │ └── unary_operation_node | ||
+ | │ ├── unary_minus_node | ||
+ | │ ├── unary_plus_node | ||
+ | │ └── not_node | ||
+ | └── lvalue_node | ||
+ | └── variable_node | ||
+ | </source> | ||
+ | }} | ||
+ | |||
+ | * '''basic_node''' -- base class for all nodes: provides information about the program location (code line) | ||
+ | * '''sequence_node''' -- node for representing sequences of other nodes | ||
+ | * '''typed_node''' -- node for typed entities (any entity that has a type): the main subclasses are '''expression_node''', '''lvalue_node''', and (in specific compilers) function/variable declaration (and definition) nodes | ||
=== Expressions === | === Expressions === | ||
− | * binary_operation_node -- | + | * '''expression_node''' (a subclass of '''typed_node''') -- superclass for all nodes representing some kind of expression (i.e., nodes that represent some value) |
− | ** add_node sub_node mul_node div_node mod_node -- | + | * '''binary_operation_node''' (a subclass of '''expression_node''') -- abstract node for describing binary operations |
− | ** and_node or_node -- | + | ** '''add_node''' '''sub_node''' '''mul_node''' '''div_node''' '''mod_node''' -- binary arithmetic operations |
− | ** lt_node le_node ge_node gt_node -- | + | ** '''and_node''' '''or_node''' -- binary logical operations |
− | ** eq_node ne_node -- | + | ** '''lt_node''' '''le_node''' '''ge_node''' '''gt_node''' -- relational operations |
− | * unary_operation_node -- | + | ** '''eq_node''' '''ne_node''' -- equality operations |
− | ** not_node | + | * '''unary_operation_node''' (a subclass of '''expression_node''') -- abstract node for describing unary operations |
+ | ** '''not_node''' '''unary_minus_node''' '''unary_plus_node''' -- miscellaneous unary operations | ||
=== Left-Values === | === Left-Values === | ||
− | * lvalue_node -- | + | * '''lvalue_node''' (a subclass of '''typed_node''') -- abstract node for describing left-value entities (i.e., entities that describe write locations) |
− | * variable_node -- | + | * '''variable_node''' -- simple left-value (atomic variable) |
− | * assignment_node -- | + | * '''assignment_node''' -- assignment node: it is actually an expression node that has both a left-value and an expression |
− | * rvalue_node -- | + | * '''rvalue_node''' -- node that represents the conversion of left-values into expressions |
=== Literals === | === Literals === | ||
− | * literal_node -- | + | * '''literal_node''' -- node that represents generic literal nodes |
− | ** double_node integer_node string_node -- | + | ** '''double_node''' '''integer_node''' '''string_node''' -- specific literal nodes |
=== Other Nodes === | === Other Nodes === | ||
− | data_node -- | + | * '''data_node''' -- opaque data node |
− | nil_node -- | + | * '''nil_node''' -- node for representing emptiness |
+ | |||
+ | == Nodes in the "Simple" Language == | ||
− | + | {{CollapsedCode|"Simple" node hierarchy| | |
+ | <source lang="text"> | ||
+ | cdk::basic_node | ||
+ | ├── evaluation_node | ||
+ | ├── if_else_node | ||
+ | ├── if_node | ||
+ | ├── print_node | ||
+ | ├── program_node | ||
+ | ├── read_node | ||
+ | └── while_node | ||
+ | </source> | ||
+ | }} | ||
− | * '''evaluation_node''' -- | + | * '''evaluation_node''' -- node for representing expressions used as instructions |
− | * '''if_node''' '''if_else_node''' -- | + | * '''if_node''' '''if_else_node''' -- variations on the if-then-else theme |
− | * '''print_node''' -- | + | * '''print_node''' -- node for representing print instructions |
− | * '''program_node''' -- | + | * '''program_node''' -- node for representing programs in Simple (i.e., the main function) |
− | * '''read_node''' -- | + | * '''read_node''' -- node for representing standard input read operations |
− | * '''while_node''' -- | + | * '''while_node''' -- node for representing "while" cycles |
[[category:Projecto de Compiladores]] | [[category:Projecto de Compiladores]] | ||
[[category:Compiladores]] | [[category:Compiladores]] | ||
[[category:Ensino]] | [[category:Ensino]] |
AVISOS - Avaliação em Época Normal |
---|
Esclarecimento de dúvidas:
|
Requisitos para desenvolvimento, material de apoio e actualizações do enunciado (ver informação completa em Projecto de Compiladores):
|
Processo de avaliação (ver informação completa em Avaliação do Projecto):
|
Material de Uso Obrigatório |
---|
As bibliotecas CDK e RTS de apoio ao desenvolvimento do projecto são de uso obrigatório: |
|
A máquina virtual, fornecida para desenvolvimento do projecto, já contém todo o material de apoio. |
Uso Obrigatório: Repositório GIT |
Apenas se consideram para avaliação os projectos existentes no repositório GIT oficial. Apenas se considera para avaliação o ramo main.
Trabalhos não presentes no repositório no final do prazo têm classificação 0 (zero) (não são aceites outras formas de entrega). Não são admitidas justificações para atrasos em sincronizações do repositório. A indisponibilidade temporária do repositório, desde que inferior a 24 horas, não justifica atrasos na submissão de um trabalho. |
CDK is the basis for compiler development in this setup. Simple is a small compiler based on the CDK.
This page focuses on the nodes, that is, the structures defined to represent the various language elements present in each package. CDK nodes tend to be general, in the sense that the concepts are reusable accross different languages. Simple provides nodes specific to the implemented language.
CDK node hierarchy |
---|
basic_node
├── data_node
├── nil_node
├── sequence_node
└── typed_node
├── expression_node
│ ├── assignment_node
│ ├── binary_operation_node
│ │ ├── add_node
│ │ ├── and_node
│ │ ├── div_node
│ │ ├── eq_node
│ │ ├── ge_node
│ │ ├── gt_node
│ │ ├── le_node
│ │ ├── lt_node
│ │ ├── mod_node
│ │ ├── mul_node
│ │ ├── ne_node
│ │ ├── or_node
│ │ └── sub_node
│ ├── literal_node
│ │ ├── double_node
│ │ ├── integer_node
│ │ └── string_node
│ ├── rvalue_node
│ └── unary_operation_node
│ ├── unary_minus_node
│ ├── unary_plus_node
│ └── not_node
└── lvalue_node
└── variable_node
|
"Simple" node hierarchy |
---|
cdk::basic_node
├── evaluation_node
├── if_else_node
├── if_node
├── print_node
├── program_node
├── read_node
└── while_node
|