Информационный сервер для программистов: Исходники со всего света. Паскальные исходники со всего света
  Powered by Поисковый сервер Яndex: Найдется ВСЁ!
На Главную Pascal Форум Информер Страны мира
   Разбор и Анализ Строк    >>    bpc-sec
 Smart Expression Compiler   Solar Designer 16.07.1996

Компилятор выражений. Генерирует ассемблерный код и выполняет его. Smart Expression Compiler for Turbo/Borland Pascal 7.0


Smart Expression Compiler for Turbo/Borland Pascal 7.0 Note: this expression compiler is known to be buggy, its optimizer will sometimes incorrectly swap operands. The code got too complex, so I've given up on it back in 1994 (didn't have a real need for it anymore as well). Except for this little detail <g>, you might find it to be a good example of hacks specific to Borland Pascal for generating x86 assembly code for an expression at runtime, with only a 25% performance penalty compared to code generated by BP itself (not that it's any good). This can also serve as an example of how complex things tend to need re-coding to make their code readable once again after some design decisions have changed. In this case, that decision was to add the ability to detect and calculate constant subexpressions at compile time. Solar Designer