Открыть Электронные книги
Категории
Открыть Аудиокниги
Категории
Открыть Журналы
Категории
Открыть Документы
Категории
: : 09.01.2008 ,
, VivaCore, . , ++.
VivaCore, .
VivaCore , , , ,
++
. , .
Viva64 64Windows-
OpenC++ [2],
Viva64
, OpenC++,
VivaCore. , / ++ VivaCore
VivaCore
VivaCore , . . , . OpenC++ .
OpenC++
, OpenC++, , wchar_t, . 2004 2003
, OpenC++? , . OpenC++ , . .
, . OpenC++ , OpenC++
, VivaCore, 1. : PureC_Foo(ptr) char *ptr; { ... } 2. ++, VisualStudio 2005/2008. , __noop, __if_exists, __ptr32, __pragma, __inter ace f . 3. . 4. 5. Viva64. 6. , L"begin"L"end") const char *name = "Viva\ Core"; OpenC++ . 7. . . (const wchar_t *str = : , , register template: object.template foo<int> ();. . 64 OpenC++: . "class" ,
VivaCore
VivaCore, .
VivaCore
VivaCore . , VivaCore . . 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. , , . , VivaCore : , , VivaCore, ,
(VisualAssist, DevExpress Refactoring, JetBrains Resharper); (Viva64, lint, Gimpel Software PC-Lint, Microsoft FxCop, Parasoft C++test); (Compuware BoundsChecker, AutomatedQA AQTime); / ++, (OpenTS); (Parasoft C++test) , , ; (Whole Tomato Software VisualAssist, ); (Synopsis, Doxygen); ; ; (C and C++ Code Counter - CCCC); (Gimpel Software PC-Lint); , (Viva64); ; , (Source-Navigator);
16.
(Ochre SourceStyler).
[4]. ++
, ,
, , #include , ".i". ( ). . , , , ( ( , ) . ). , . , ,
" ,
").
. .
. AST
, . VivaCore / ++
. VivaCore . , . / ++
VivaCore
VivaCore . 1.
1-
VivaCore.
1)
VivaCore . Wave C++ preprocessor library, Microsoft Visual C++)
(Input subsystem)
/ ++ , The . ( , / VivaCore . (PT) , , . , , . : VivaConfiguration, ReadFile. . VivaCore. , , , . ++ . , , "i".
2) subsystem)
, . VivaCore.
y
(Preprocessor
, : . ). . , . , . , ,
( ,
, SA_Success
Viva64 SA_FormatString,
3)
. , .
(Lexer)
, ,
!
,
2-
VivaCore Token.h), . CLASS WCHAR "class" "wchar_t" . . tokennames.h "table" , . "tableC" . Lex.cc. , CLASS, "class" ++ , tokennames.h.
Token ( :
++ .
. , VivaCore
DumpEx 258 258 91 262 93 59 303 123 282 42 258 LC_ID lc_id [ 6 ] ; struct { char * locale 5 5 1 1 1 1 6 1 4 1 6
4)
(Parser)
(derivation tree- DT), . , VivaCore ( ST), , .
++. , . , , ,
Leaf.
3. , Ptree
const = 0 " ,
NonLeaf
Leaf.
, . Lis .
, , int MyFoo(const float value) { if (value < 1.0) return sizeof(unsigned long *); return value * 4.0f < 10.0f ? 0 : 1; } , 4.1-4.4. , :
"
. ,
'
'
&%$# "
Vv ,
e ,
Parser. NonLeaf .
4.1.
4.2.
3 2
2 2 3
4.3.
4.4.
( Encoding.
, Encoding.cc.
IsBuiltInTy e
". .cpp" , , , , , , . . . , .
. :
PtreeExprState ent ,
. ,
Ty eInfo, .
7
. ),
, , IsFunction, IsPointerTy e, .
treeDeclarator:[ Leaf:MyFoo Leaf:( NonLeaf:[ NonLeaf:[ NonLeaf:[ LeafCONST:const NonLeaf:[ LeafFLOAT:float ] ] treeDeclarator:[ Leaf:value ] ] ] Leaf:)
] [{ NonLeaf:[ treeIfStatement:[ LeafReserved:if Leaf:( treeInfixExpr:[ LeafName:value Leaf:< Leaf:1.0 ] Leaf:) treeReturnStatement:[
LeafReserved:return treeSizeofExpr:[ Leaf:sizeof Leaf:( NonLeaf:[ NonLeaf:[ LeafUNSIGNED:unsigned LeafLONG:long ] treeDeclarator:[ Leaf:* ] ] Leaf:) ] Leaf:; ] ] treeReturnStatement:[ LeafReserved:return treeCondExpr:[ treeInfixExpr:[ treeInfixExpr:[ LeafName:value Leaf:* Leaf:4.0f ] Leaf:< Leaf:10.0f ]
C C C C
, -
, , XML.
5)
( , , , . Walker ClassWalker , , ClassBodyWalker. VivaCore, . , , :
Ptree* ClassWalker::TranslateUnary(Ptree* exp) { using namespace PtreeUtil;
[6])
/ Walker ++.
++. ,
Ptree* unaryop = exp ->Car(); Ptree* right = PtreeUtil::Second(exp); Ptree* right2 = Translate(right); if(right == right2) return exp; else return new (GC_QuickAlloc) PtreeUnaryExpr(unaryop, PtreeUtil::List(right2)); }
, ,
, ( . . )
, .
, TranslateUnary. .
, PtreeUnaryExpr,
Ptree* VivaWalker::TranslateThrow(Ptree *p) { Ptree *result = ClassWalker::TranslateThrow(p); Ptree* oprnd = PtreeUtil::Second(result); if (oprnd != NULL) { //if oprnd==NULL then this is "throw;". if (!CreateWiseType(oprnd)) {
return result; } if (IsErrorActive(115) && !ApplyRuleN10(oprnd ->m_wiseType.m_simpleType)) { AddError(VivaErrors::V115(), p, 115); } } return result; }
. . Environment,
env
6)
, , . ( , . , , . . , , ). ,
++. VivaCore
++
. / ++.
OpenC++. . : Metaclass.
7)
, VivaCore. . , , XML, . XML . XML XML VivaCore . , XML . , C# . , , SGML. , . . , , ,
1. . Viva64 ? http://viva64.com/art-1-1-2081052208.html 2. OpenC++ library. http://www.viva64.com/go.php?url=16 3. Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools (2nd Edition). Addison Wesley, 2006, 1000 pages. 4. Flemming Nielson, Hanne R. Nielson, Chris Hankin. Principles of Program Analysis. Springer, 2004, 452 pages. 5. Semantic Designs site. http://www.viva64.com/go.php?url=19 6. Patrick Cousot. Static Analysis. Springer, 2001, 450 pages.