# Parser-PKB API Iteration 2 Additions
```java=
// PKB cannot obtain range of procedures, so this API will be useful. Pass in the first and last stmts of every procedure.
void addProcedureStmtRange(STMT_NO firstStmtNo, STMT_NO lastStmtNo);
// The PKB is able to obtain the first and last stmt of while blocks and if blocks using its Parent* linkages.
// However, it is unable to ascertain the end of a then block and the start of a else block.
// This API is thus to allocate the cut-off point for the if block in question (represented by its statement number)
void addIfBlockSplit(STMT_NO ifStmtNo, STMT_NO firstElseBlkStmtNo);
```
# PARSER-PKB API v0.1 (Headers Only)
While creating the AST, the Parser will call Parser-PKB APIs to update its vartable entries regarding design entities & abstractions. This stage is referred to as "pre-processing".
After the AST construction is complete, it will call `setAST` which will then trigger "post-processing" (finalization of the vartables using information only accessible after the completion of the AST construction).
API ideation (and to some extent, justification) be found [here](https://docs.google.com/document/d/13bbHWbFKwuhLJJ5fvMNWm6k6nMNwSs7n_sV3X3izGBE/edit#) from p10 - 12.
## INDIVIDUAL DESIGN ENTITIES
```
//Adds an assignment statement
VOID addAssign(STMT stmt, AST node)
//Adds a read statement
VOID addRead(STMT stmt, AST node)
//Adds a print statement
VOID addPrint(STMT stmt, AST node)
//Adds a call statement
VOID addCall(STMT stmt, AST node)
//Adds a while statement
VOID addWhile(STMT stmt, AST node)
//Adds a if statement
VOID addIf(STMT stmt, AST node)
//Adds a assign statement
VOID addAssign(STMT stmt, AST node)
//Adds a variable
VOID addVariable(STMT stmt, AST node)
//Adds a constant
VOID addConstant(STMT stmt, AST node)
//Adds procedure name var1
VOID addProcedureName(AST var1)
```
## FOLLOWS
```
// stmt2 follows stmt2
VOID addFollowsRel(STMT stmt1, STMT stmt2)
```
## PARENT
```
// stmt1 is the parent of stmt2
VOID addParentRel(STMT stmt1, STMT stmt2)
```
## USES
```
// stmt1 uses var1
VOID addStmtUses(STMT stmt1, AST var1)
// Procedure proc1 uses var1
VOID addProcUses(AST proc1, AST var1)
// Container stmt cont1 uses var1
VOID addContainerUses(STMT con1, AST var1)
```
## MODIFIES
```
// stmt1 modifies var1
VOID addStmtModifies(STMT stmt1, AST var1)
// Procedure proc1 modifies var1
VOID addProcModifies(AST proc1, AST var1)
// Container stmt cont1 modifies var1
VOID addContainerModifies(STMT con1, AST var1)
```
## CALLS
```
//add procedure being called
VOID addCalledProc(AST callStmt, VAR procName)
//add procedure call is in
VOID addProcCall(AST procName, AST callStmt)
//add container call is in
VOID addContainerCall(AST con1, AST callStmt)
```
## AST
```
// set root of AST
VOID setAST(AST root)
```
# Under discussion
## ASSIGNMENT (kiv)
```
// set assignment for statement stmt1 between var1 and nodeRight
VOID addStmtAssignment(STMT stmt1, VAR var1, AST nodeRight)
```