Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


#284 Internal Structure Access


Would it ever be possible to have fbc.exe (or a DLL/SO-only form of FB's parser/lexer) emit details about the source it's processing?

For example, if it were invoked with "-suggest 7 2", could a list of possible suggestions for line 7, column 2 be emitted? A better example:

type something
   as integer a, b, c
end type

dim as something x


If "-suggest" were passed with the position of the . at the end of the file, fbc would generate:


Similarly, a "-signature" option, passed the name of a function, would emit its arguments in a similar format. These could even be undocumented in fbc's "-help" output, if it would create too much clutter.

I know, this is a crazy request. I just know that clang does something exactly like this (and I use it in vim, to great effect!) so I figured that instead of writing my own FB parser/lexer to do this (and likely never finishing it) I would just propose this.


  • dkl

    Yea, it'd be very nice to turn fbc's parser/AST/symbol tables into a library. Including callbacks for error reporting and recovery. It's safe to say that the code currently isn't ready for this, though there have been adjustments to move into that direction and I think it'd be exciting to finish this.

    Making such suggestions should be very easy from within the parser where an error occurs. Ideally it'd be connected to the error recovery. This would surely be quite some work when doing it for all cases of error handling in the parser, but at least it could be done step by step.

    And then it could even filter the error recovery tips based on source location. Tracking the column reliably will need some additional work on the lexer though I think.