Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 2
0
 public CExpressionStatement(CEmmitableCodeContainer parent) : base(CodeBlockType.CB_EXPRESSIONSTATEMENT, parent, 1)
 {
 }
Ejemplo n.º 3
0
 public CIfStatement(CEmmitableCodeContainer parent) : base(CodeBlockType.CB_IFSTATEMENT, parent, 3)
 {
 }
Ejemplo n.º 4
0
 public CCFunctionDefinition(CEmmitableCodeContainer parent) : base(CodeBlockType.CB_FUNCTIONDEFINITION, parent, 2)
 {
     m_file = parent as CCFile;
 }
Ejemplo n.º 5
0
 public CWhileStatement(CEmmitableCodeContainer parent) : base(CodeBlockType.CB_WHILESTATEMENT, parent, 2)
 {
 }
Ejemplo n.º 6
0
 public CCompoundStatement(CEmmitableCodeContainer parent) : base(CodeBlockType.CB_COMPOUNDSTATEMENT, parent, 2)
 {
 }
Ejemplo n.º 7
0
 public CReturnStatement(CEmmitableCodeContainer parent) : base(CodeBlockType.CB_RETURNSTATEMENT, parent, 1)
 {
 }