I need to make application that would accept Pascal code and check if it
returns good results.
well, it depends on how much work you want your program to do.
My understanding is that most compilers will return a non-zero
error code when there's some sort of problem. Thus, you could
just shell out to compile the code and check the resulting code.
Time to implementation: likely less than 20 minutes, testing
included.
OTOH, you could actually parse the pascal file(s). This gives
you infinte flexibility to do whatever you want with the
parse-tree. Things get hairy when you have included ("uses")
files, and you also have to write up a grammar for Pascal that
can be understood by Python. The common wisdom seems to be to
use PyParsing[1] for such parsing tasks. You'd also have to
decide which flavor of Pascal you intend to parse (pascal, turbo
pascal, object pascal, delphi, etc). You might be able to use
some of the parser definitions from the Free Pascal[2] project as
a model on which to base your parser's syntax. Time to break out
the old Pascal language rail-road diagrams from CSC101.
Time to implementation: weeks or months or even years
As you can see, if you can get an existing pascal parser to do
the work for you, and all you need to know is whether it built
successfully, option "A" should be your obvious choice. If you
have some deeper need to wander around this parsed structure,
you're stuck with the labor involved in option "B".
-tkc
[1] pyparsing.wikispaces.com
[2]
www.freepascal.org