[Gnome-devtools] Language Analysis Framework



Hello,
  I did not yet complete a design for the language analysis framework.
It is mostly complete, but there is a few things I would like to
discuss.

Versioning:
It seems to do incremental lexing and parsing optimally (and sometimes
correctly), the framework requires the history services. Versioning
doesn't look that hard to do, a least a basic version of it. It is
basically keeping track of everything you do at a very low level, so you
can undo these changes at the same level and get the previous document.
This is what they refer to as fine-grained versioning. Corse grain
versioning is the difference between two versions after a series of
operations, corse-grain versions are created with begin_edit/end_edit
methods. I think it would be nice to have methods that write the history
to a file too. Also it would be cool to sync major versions of the
document with those in CVS, but I'm not even going to think about doing
something like this until the basics are working.

Database:
Harmonia lacked a document database, if you are working with a file
that is dependent on other files you need to have their representation
loaded as well to do correct semantic analysis. An exmple of this is if
you use a C struct defined in a seperate file and you need to know if a
an indentifier is part of that struct. I think a solution to this
problem is to put all the documents in a shared database. Loading
dependent files into the
database would be the resonsibility of the parser specification. I'm by
no means a database expert, so if anyone has any idea for the
implentation of this, let me know.

Incremental Semantic Analysis:
Incremental semantic analysis seems to be an active field of research.
I'm
not even going to attempt to formulate a semantic analysis language, or
implement a compiler for one. Therfore, I think semantic analysis should
be hand coded in the language modules. It would still require facilities
in the Language Kernel though. My idea is that in the parser
specification, first you would list all the nodes(terminal and
non-terminal) that require semantic analysis. When a new node is
encountered that requires semantic analysis, it would call the semantic
analysis function in the language module. This function would give a
string value to the node, and then set up the dependency lists for it.
Whenever a semantic node is modified all of its dependents would be
invalidated, and thus require reanalysis. I'm not sure of the exact
interface for this. I think the Language Kernel would need a symbol
table, and methods for accessing it. Also there is a data structure
required for dependencies, and also methods for modifying them.

Those are the main issues, overall I think I have a pretty good grasp of
the framework. The data structures and interfaces I've designed are a
bit sketchy though. It is hard to figure out in advance how the
components will interact, what data is required, and the proper
interface for the components.

Mark




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]