[fpc-pascal] Build in a C compiler
leledumbo
leledumbo_cool at yahoo.co.id
Wed Apr 20 08:58:29 CEST 2016
> That would be great.
Nope
> It is not that difficult.
> { = begin
> } = end
>
> and the other stuff is quite similar.
Syntax is easy, well once you have fully working preprocessor too, but how
about libraries? How will you convert scanf/printf/puts/etc? What if it uses
3rd party libraries?
> Pascal and C are close related.
Only at the surface. There are many semantics differences that's not
convertible at all. e.g.: ALL C expressions are potentially a boolean
expression which in turn has boolean value, while in Pascal, only boolean
expression has boolean value. At syntax level, there's no Pascal equivalent
of C's comma (sequence) operator. Argument evaluation in C is strictly right
to left, in Pascal it's up to the compiler. A silly but valid C statement:
printf("%d%d%d\n",i++,++i,++i,i++);
would be hard to convert to Pascal automatically without blowing out the
compiler.
--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Build-in-a-C-compiler-tp5725008p5725010.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
More information about the fpc-pascal
mailing list