Package net.emustudio.edigen.generation
Class GenerateFieldsVisitor
- java.lang.Object
-
- net.emustudio.edigen.Visitor
-
- net.emustudio.edigen.generation.GenerateFieldsVisitor
-
public class GenerateFieldsVisitor extends Visitor
A visitor which generates Java source code of the instruction decoder fields for rules and values. Each rule (which has at least one returning variant) and string-returning variant is given a unique integral constant which can be later used in a disassembler and emulator.
-
-
Constructor Summary
Constructors Constructor Description GenerateFieldsVisitor(java.io.Writer writer)Constucts the visitor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidvisit(Decoder decoder)Writes the constants.voidvisit(Rule rule)Adds the field names for the particular rule to the list.voidvisit(Variant variant)Adds the field to the list and sets the flag if the variant returns something.
-
-
-
Method Detail
-
visit
public void visit(Decoder decoder) throws SemanticException
Writes the constants.- Overrides:
visitin classVisitor- Parameters:
decoder- the decoder node- Throws:
SemanticException- never
-
visit
public void visit(Rule rule) throws SemanticException
Adds the field names for the particular rule to the list.- Overrides:
visitin classVisitor- Parameters:
rule- the rule node- Throws:
SemanticException- never
-
-