Информационный сервер для программистов: Исходники со всего света. Паскальные исходники со всего света
  Powered by Поисковый сервер Яndex: Найдется ВСЁ!
На Главную Pascal Форум Информер Страны мира
   Разбор и Анализ Строк    >>    parse10
   
 
 Parser 1.0 - Recursive Parser with functions  Loewy Ron 14.06.1991

Recursive decent expression parser with +-/*^ and trigonomethric functions for turbo-pascal



5k 
 

******************************************************************************* * parser * * recursive decent expression parser for turbo-pascal, Loewy Ron, 1991. * * parser.doc, Last Update : Jun. 14, 1991. * ******************************************************************************* Introduction ------------ Parser is a recursive decent expression parser unit for Turbo-Pascal, this unit includes the 5 basic math. operators (+ - * / ^), and some basic mathematical functions (sin, exp, cos, ln, log10, log2, abs, arctan, sqr, sqrt, tan, cotan, arcsin, arccos) and 2 constants (pi, e). Parser can be used to receive formula input from the user, and perform the neccessary calculations during program runtime. Parser supports 10 general purpose variables (v0, v1, .., v9) that can be set (using the = operator) and used in formulas by the user. Operation --------- Simply use parser unit in your program using the USES clause, when ever you want to parse a string formula do : macro := stringFormula; { stringFormula is where you've got the formula } myResult := getExpr(validity); if (validity = false) then tellError { the formula has an error at the errAt byte } else tellResult(myResult); Please notice - the source code is provided, so you will probably find it easy to understand that example after you will look into the code. Contact ------- You can contact me on what-ever you want to at my address at : Loewy Ron, Loewy Ron 9 Haneveem st. Or 20 Smolanskin st. Herzeliya, 46465, Haifa, 34366, Israel. Israel.