+ source\include\harbourl.slx
+ source\compiler\harbourl.c
This is a propoesed new Generic Lexer (SimpLex) that along with language definition file (Harbour.slx) consititue
the proposed new Harbour Lexer. It is about half the size of the Flex Lexer and Harbour.exe is about 60K smaller.
This might help with 16bit mode and or memory limited situations. It belive it offers few benefits over Flex:
Simplicity, Readability, and Consitency of the rules.
More elegant look ahead/parsing capabilities.
Does not require a 3rd party tool (the Tokens & Rules table, is inserted into the Lexer by means of an #include directive.
it doesn't need to be "compiled" like the Flex.exe produces harbourl.c from harbour.l.
It is much smaller than the Flex generated Lexer.
Please note it is not yet optimized for speed, I would love to get your input/suggestion (Ryszard, Victor, Paul, ...).
In the process of resaerching the Lex phase I found many "problems" and tried to address them all. It now compiles
the full build including keywords.prg (3 compiler (yacc) errors), our previous lexer didn't fully parse keywords.prg
Please forward your opinions...
* source/compiler/harbour.l
+ Added rule for orphan "]"
* Monor improvments to INDEX
* source/compiler/hbgenerr.c
* Minor improvements
* source/pp/ppcomp.c
! Corrected line number was adding EmptyLines twice.
* source/compiler/hbgenerr.c
! Refined line numbers reported.
* source/compiler/harbour.l
! Rewrote (again) rules for STRING1 STRING2 STRING3 INDEX. Rules for strings much simpler.
/* Flex had some problem with $ that caused output of strings. */
* include/hbclass.ch
- Uncommented the VO #xtranslate as they do work correctly.
* source/pp/pplib.c
- Removed int hb_comp_iIncLine
* include/hbcomp.h
- Removed int hb_comp_iIncLine
+ Added int hb_comp_iCompiled
+ Added char* hb_comp_szFile
+ Added BOOL hb_comp_bError
* source/compiler/harbour.c
! Fixed Compile Time Line Numbers
! Fixed Run Time Line Numbers
* source/compiler/harbour.l
! Rewrote rules for STRING1 STRING2 STRING3 INDEX, were severly broken with regard to unterminated support.
/* When working on errors, I founf major problems, with unterminated Array Index and Unterminated Strings
I'm surprised no one reported. This mass was a nightmere to fix. it seems to be working great now. */
* source/compiler/harbour.y
! Many fixes to support correct line numbers.
* source/compiler/hbgenerr.c
! Fixed Error System to never report more than 1 error per source line.
* source/pp/ppcomp.c
- Removed code for hb_comp_iIncLine
* source/pp/ppcore.c
* Minor formating.
* source/pp/ppcore.c
! Added bStrict parameter to getExpReal(), all calls to getExpReal() pass FALSE, other than isExpres().
So getExpReal() will now return invalid tokens like unterminated strings, unless bStrict is TRUE.