My graduation thesis was construction and analysis of
simple language-oriented development environment. Language-oriented
environments are programming environments which are aware of programming
language lexical and syntax rules. They analyze program code incrementally,
which allows them to recognize language constructs like loops, function
declarations, expressions, comments, statements, class declarations and
other important program structures. With all that information available
during editing, programming environment becomes more interactive and
productive. Figure 1-1 shows a simple PASCAL-like program
inside a language-oriented
environment. Available lexical information is used for lexical coloring
of the program code (often wrongly referred as "syntax highlighting"). Available
syntax information is used to highlight syntax structure at the current
cursor position (eg. FOR-loop language construct).
Figure 1-1: Simple language-oriented development environment
Information about current syntax construct is useful in
cases when current syntax is not obvious. That is the case with nested
brackets in complex expressions (Figure 1-2), ambiguous IF-statements
(mismatched ELSE problem) and nested program structures.
Figure 1-2: Matching brackets in complex expression
Synchronous information about program syntax structure
allows immediate detection of syntax errors. Figure 1-3 and Figure 1-4
show examples of errors which are immediately detected in language-oriented
environment (errors are underlined in red). In normal environments such errors are not discovered until
compilation time.
Figure 1-3: Extra operator syntax error
Figure 1-4: Bad function call syntax error
Although demonstrated environment looks quite simple and
with simple set of features, the technology behind the scenes is quite
complex. Incremental lexical and syntax analysis require much more complex
algorithms than one-time linear analysis. What is even worse, efficient
incremental syntax analysis of some languages is still an unsolved problem in
scientific literature. For more information about efficiency of implemented
incremental syntax analyzer, see seminar project.