Beispiel #1
0
        public virtual void DeclareVariable(string varname, bool isread)
        {
            CodeContainer rep;

            if (!m_localSymbolTable.Contains(varname))
            {
                if (isread)
                {
                    m_file.DeclareGlobalVariable(varname);
                }
                else
                {
                    rep = new CodeContainer(CodeBlockType.CB_CODEREPOSITORY, this);
                    m_localSymbolTable.Add(varname);

                    rep.AddCode("float " + varname + ";\n", CodeContextType.CC_NA);
                    CEmmitableCodeContainer compoundst = GetChild(CodeContextType.CC_FUNCTIONDEFINITION_BODY);
                    compoundst.AddCode(rep, CodeContextType.CC_COMPOUNDSTATEMENT_DECLARATIONS);
                }
            }
        }
Beispiel #2
0
 public CExpressionStatement(CEmmitableCodeContainer parent) : base(CodeBlockType.CB_EXPRESSIONSTATEMENT, parent, 1)
 {
 }
Beispiel #3
0
 public CIfStatement(CEmmitableCodeContainer parent) : base(CodeBlockType.CB_IFSTATEMENT, parent, 3)
 {
 }
Beispiel #4
0
 public CCFunctionDefinition(CEmmitableCodeContainer parent) : base(CodeBlockType.CB_FUNCTIONDEFINITION, parent, 2)
 {
     m_file = parent as CCFile;
 }
Beispiel #5
0
 public CWhileStatement(CEmmitableCodeContainer parent) : base(CodeBlockType.CB_WHILESTATEMENT, parent, 2)
 {
 }
Beispiel #6
0
 public CCompoundStatement(CEmmitableCodeContainer parent) : base(CodeBlockType.CB_COMPOUNDSTATEMENT, parent, 2)
 {
 }
Beispiel #7
0
 public CReturnStatement(CEmmitableCodeContainer parent) : base(CodeBlockType.CB_RETURNSTATEMENT, parent, 1)
 {
 }