-
Notifications
You must be signed in to change notification settings - Fork 28
Conversation
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.
Tests are missing and coding needs to be improved before merging in your own interest.
|
||
import java.util.Stack; | ||
|
||
public class AtomicExprSymbolTable extends SymbolTableBuilder{ |
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.
Please do not create an own class, but use the SymbolTableBuilder
class.
Stack<Scope> currentScopes = new Stack<>(); | ||
|
||
@Override | ||
public Void visitEntry(ASTEntryNode node) { |
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.
Please use your own visit method, not visitEntry
visitChildren(node); | ||
|
||
|
||
if (rootScope.lookupSymbol("identifier") == null) |
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.
You are always searching for "identifier" whenever a variable is referenced. This is not what should be done. Please fix.
|
||
|
||
if (rootScope.lookupSymbol("identifier") == null) | ||
throw new SemaError("No identifier found"); |
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.
Please print a better error message, that includes the name of the referenced variable
|
||
@Override | ||
public Void visitEntry(ASTEntryNode node) { | ||
Scope rootScope = new Scope(); |
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.
You don't need any scopes-related boilerplate coding for your AtomicExprNode.
No description provided.