-
Notifications
You must be signed in to change notification settings - Fork 1
Six architecture properties as part of design mark #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7d06f6f
9a0505d
c2c3db4
1c0daea
e77441c
1a9b42a
81d49e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| .. _sec:architecture: | ||
|
|
||
| Architecture | ||
| ============ | ||
|
|
||
| You should write your compiler as a series of passes each with simple functionality. Do not implement your compiler as a single pass. As a minimum, your compiler should have individual passes that perform each of the following actions: | ||
|
|
||
| * Create an abstract syntax tree. | ||
| * Define symbols and ensure that symbols can be referenced in the locations they are used. These actions may be performed by two separate passes. | ||
| * Propagate type information through expressions and perform static type checking. These actions may be performed by two separate passes. | ||
| * Emit LLVM, SCF, Memref and Arith Dialects that can be lowered into LLVM IR. | ||
|
|
||
| Your compiler should use a symbol table to track symbol definitions and scopes. | ||
|
|
||
| These passes are also assessed against the architecture properties listed under Design in the :external+info:doc:`grading criteria <grading>`. All six properties apply to *Gazprea*. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| /* The RTD theme sets white-space: nowrap on table cells, which forces wide | ||
| * tables horizontally scrollable. Tables marked .wrap-table wrap instead. */ | ||
| .wrap-table td, .wrap-table th { | ||
| white-space: normal !important; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,11 +29,53 @@ product: scalability, flexibility, and maintainability. | |
| You need to design an AST and Symbol table, and use them to implement | ||
| multiple passes including: symbol definitions, symbol resolutions and | ||
| semantic checking, type checking, and code generation. | ||
| The passes your compiler must have are listed under :external+vcalc:doc:`Architecture <impl/architecture>`. | ||
|
|
||
| * **Gazprea** While the top-level architecture is almost identical to | ||
| *VCalc*, the rich type system within can increase complexity | ||
| substantially unless it is managed. It is also important to understand | ||
| and select dialects that make sense for your design. | ||
| The passes your compiler must have are listed under :external+gazprea:doc:`Architecture <impl/architecture>`. | ||
|
|
||
|
|
||
| Architecture Properties | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| Part of the design mark is the following properties of your implementation, assessed by inspection of your code. Each is marked separately, and only on the projects marked below. None of them apply to *Generator*. | ||
|
|
||
| .. list-table:: | ||
| :header-rows: 1 | ||
| :widths: 76 8 8 8 | ||
| :class: wrap-table | ||
|
|
||
| * - **Property** | ||
| - LOLCODE | ||
| - VCalc | ||
| - Gazprea | ||
| * - **Types are decided once.** Your emission pass must not compute or infer the type of an expression. It reads type information recorded by an earlier pass. | ||
| - | ||
| - ✓ | ||
| - ✓ | ||
| * - **One source of truth for conversions.** The rules deciding whether a conversion is legal and the code performing that conversion must not be two lists kept in agreement by hand. If they are separate, something in your build must check that they agree. | ||
| - ✓ | ||
| - ✓ | ||
| - ✓ | ||
| * - **Pass dependencies are written down.** Each pass must state what it requires to already be true when it runs. If reordering two of your passes breaks your compiler, that dependency must appear somewhere a reader can find it. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmmmmmmmm phase ordering be like. How do we enforce this?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure we need this level of detail? Should this be something they write in their design document vs something we look for in the code?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Sir-NoChill my plan for each of these 6 points was to ask claude if they are fulfilled. The GenAI seminar I went through describes bias in LLM grading, but this does not apply to yes/no questions, so I think it is safe here. |
||
| - | ||
| - ✓ | ||
| - ✓ | ||
| * - **Element-wise operations share their emission.** Adding a new operator over vectors or matrices must not require writing new index arithmetic. | ||
| - | ||
| - ✓ | ||
| - ✓ | ||
| * - **Names are resolved once.** Your emission pass must not look a name up by string. Symbol resolution happens in an earlier pass, and later passes use the resolved symbol. | ||
| - | ||
| - ✓ | ||
| - ✓ | ||
| * - **Locations are recorded at construction.** Every node carries the source location it came from, assigned when the node is built. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we mandate dwarf symbol emission behind a -g flag? Similar to -ffast-math ?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is debug symbol emission automatic? When I did it before it was a lot of work because you have to describe the symbol to the debugger so it can interpret the contents correctly. I wouldn't mind having an assignment where they add debug to vcalc. Or maybe we could have a lab where they do what they can in 3 hours and we mark it? |
||
| - | ||
| - | ||
| - ✓ | ||
|
|
||
| Software Engineering Processes | ||
| ------------------------------ | ||
|
|
@@ -92,7 +134,7 @@ Code Style and Consistency | |
| * You are expected to separate class definitions from implementations using header (.h) and source (.cpp) | ||
| files. | ||
| * Your code should be clean and readable. | ||
| * There is no minimum expectation for commenting or documentation. | ||
| * There is no minimum expectation for commenting or documentation, except where the design requirements require a design decision to be recorded. | ||
|
|
||
| TA Specification Tests | ||
| ---------------------- | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| .. _sec:vcalc_architecture: | ||
|
|
||
| Architecture | ||
| ============ | ||
|
|
||
| You should write your compiler as a series of passes each with simple functionality. Do not implement your compiler as a single pass. As a minimum, your compiler should have individual passes that perform each of the following actions: | ||
|
|
||
| * Create an abstract syntax tree. | ||
| * Emit LLVM, SCF, Memref and Arith Dialects that can be lowered into LLVM IR. | ||
|
|
||
| These passes are also assessed against the architecture properties listed under Design in the :external+info:doc:`grading criteria <grading>`. Five of the six apply to *VCalc*. | ||
|
|
||
| Some VCalc designs do not carry over to Gazprea. Gazprea has multiple scalar types with promotion between them, nested tuple types, matrices and strings alongside vectors, assignable expressions other than plain identifiers, and routines callable before they are defined. A VCalc compiler can reasonably assume a single scalar type, a flat type tag, a one-dimensional vector representation, and one value per expression; none of these assumptions hold in Gazprea. Consider this when choosing how to represent types and values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆