<!-- document best viewed in live preview -->

# Todo's

## Dingen die we in het rapport willen noemen
- <s>Preprocessing met gebruik van `tmpfile()`</s>
- Splitsing van array-transformaties zodat context-informatie beschikbaar is bij call
  - (array_def_rewrite, st_construct, array_call_rewrite, check_types)
- const types voor for loop + array dimensions
- Wat een hel arrays waren



## Code generation
### Done:

- Binops
- Monops
- Constants (incl constant pool)
- While/Do loop
- If statements
- Stores/variable stuff
- Calls
- For loops
- import/export
- Some dead code removal
- Arrays, if we're doing those

## Testing
### Done:
- Validate that main returns an integer and takes no parameters
- Check that function declaration has no more than 255 parameters
- Proper location of localfundefs (i.e. not after the function label)
- Check that local functions can't be defined export or extern
- Check that extern functions can't have function bodies
- For loop step value can't be zero [note: only checking if it is a literal constant, but maybe optimisations can improve it.]
- const assignment

### Not done:
- for induction variable assingment
- Deal with extra array dim variables in 255 param limit
-

## Other stuff:
- <s>Fix C preprocessor run (output to temporary buffer/pipe?)</s>
- <s>Memory management (valgrind, we probably aren't freeing stuff)</s>
- Fix includes

## Array tings:
Elementen die doorgehaald zijn zijn af.

- <s>Parser support</s>
  - <s>Param grammar</s>
  - <s>ArrExpr grammar</s>
  - <s>GlobalDec grammar</s>
  - <s>Expr grammar</s>
  - <s>Assignment grammar</s>
  - <s>VarDec grammar</s>
  - <s>GlobalDef grammar</s>

_(the parser actually supports multidim arrays for all of these)_

- Semantic analysis (functions getting extra args, declaration creating a length var, calls passin)
  - <s>Functions getting extra arguments</s>
  - <s>Declarations creating new variables for the dimensions</s>
    - <s>Globaldef in the right order (currently appends, should prepend)</s>
  - <s>Calls passing length</s>
  - <s>Dimension checking for calls</s>
  - <s>Dimension checking for indexing</s>
  - <s>Indexing yielding element type in check_types</s>

- <s>Export array size</s>
- <s>Rewriting multidimensional arrays</s>

- Code generation
  - <s>Loading/storing array indices and initialisation of array references</s>
  - <s>Initialisation of array values (ArrExpr)</s>

- Symbol table stuff
  - <s>type_t has array flag</s>
  - <s>type_t macros TY_IS_ARRAY and TY_ARRAY_ELEMENT_TYPE</s>

## Opmerkingen voor in rapport maybe:
- Splitsing van array-transformaties zodat context-informatie beschikbaar is bij call
  - (array_def_rewrite, st_construct, array_call_rewrite, check_types)
- const types voor for loop + array dimensions
- Wat een hel arrays waren
