#include "stdafx.h" #include "paxcompilerlib.h" int main(int argc, char* argv[]) { HMODULE h_lib = LoadPaxCompilerLib(); if (h_lib != 0) { DWORD hc = PaxCompiler_Create(); DWORD hl = PaxPascalLanguage_Create(); DWORD hp = PaxProgram_Create(); PaxCompiler_Reset(hc); PaxCompiler_RegisterLanguage(hc, hl); PaxCompiler_AddModule(hc, "1", "Pascal"); PaxCompiler_AddCode(hc, "1", "begin"); PaxCompiler_AddCode(hc, "1", " writeln('Hello');"); PaxCompiler_AddCode(hc, "1", "end."); if (PaxCompiler_Compile(hc, hp)) { PaxProgram_Run(hp); } else { printf("there are errors:\n"); for (int i = 0; i < PaxCompiler_GetErrorCount(hc); i++) { printf(PaxCompiler_GetErrorMessage(hc, i)); } } PaxProgram_Destroy(hp); PaxPascalLanguage_Destroy(hl); PaxCompiler_Destroy(hc); } FreePaxCompilerLib(h_lib); getchar(); return 0; }