[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnubol: subsets
Sorry about the slip of the send key.
>>>>> "Bob" == RKRayhawk <RKRayhawk@aol.com>
>>>>> wrote the following on Wed, 17 Nov 1999 18:16:08 EST
Bob> In a message dated 11/16/99 10:16:49 PM EST, Michael McKernan,
Bob> mck@tivoli.mv.com writes, while describing a specific syntax
Bob> issue:
Bob> ...snips ... << Treating it in semantics is not much
Bob> better. It would mean putting the otherwise useless END-x
Bob> delimiters into the intermediate, and would still be difficult
Bob> to diagnose while you're in the right neighborhood.
>>>
Bob> ... snips ...
Bob> Okay, design then. What do you see as the interface from
Bob> syntax to semantics? What does a unit of work exchanged
Bob> between them look like? What is the stream of units of work
Bob> from syntax to semantics? General pictures.
I'm aware of several things that are workable. We may have a single
AST to serve as both symbol table and intermediate form or we may
have a more conventional symbol table and reverse polish, flattened
trees or some other representation of the declarations and
statements. I don't get to dictate this, but I do have opinions
about it. A single AST is pleasant to work with, but it has to be
made in such a way that it can be modified fairly readily, because
the source forms are often further removed from their semantics than
is the case in most languages. (inspect, evaluate, condition-names,
everything in report writer...) The alternative may turn out to be
preferable for that reason. Someone else may have a scheme that
hasn't occurred to me, but, whatever it is, it must be a
representation of the source program and probably doesn't invalidate
my conclusion which you cite above.
Bob> Is there an intermediate? How many intermediate stages? Is
Bob> there an AST? Any GNUish things around that you feel are worth
Bob> canibalizing?
You bet there's an intermediate; I can see no way to get to code
directly from the parser. The first intermediate is input to a
semantics processor which is probably a pass, but does not absolutely
have to be. I can't think of anything in GNU except, of course, the
gcc back-end, but there may be other things.
Bob> Tell you what, don't worry about error messages for
Bob> now. Obviously all that is needed everywhere so it will get
Bob> folded in, somehow, someday. For now what is a unit of work in
Bob> the interface from syntax to semantics? What things about
Bob> COBOL determine that design?
Bob> What COBOL things are crucial to understand in designing the
Bob> semantics? The big things. Not tokens, not pieces. What is the
Bob> visage of a thing that comes through the front door of
Bob> semanitcs. From the Data Division and from the Procedure
Bob> Division. Approximately what shape are these hulks that would
Bob> be a unit of work?
Maybe it's more death by a thousand cuts. Here's a sampling.
Let's continue to leave the form of the intermediate open -- It does
not materially affect what semantics has to do. Essentially, Data
Division semantics has to make proper structures out of level
numbered entries if we haven't gotten the parser to do that. It's
responsible for storage allocation including alignment
considerations, auxiliary storage (indexes) and externals,
creating initialization records, validating that the individual
clauses in each declaration entry are not in conflict with one
another, noting aliasing which occurs when a variable is passed by
reference or otherwise has its address taken. It validates and
compiles pictures. It updates the symbols for all of these things.
Procedure Division semantics may reduce control structures to more
basic operations but this is dependent on what the code generator is
prepared to accept. For individual verbs, it validates that the
operand types are compatible with the verb and with one another or
thet they can be converted to types that are, and inserts the
conversions where necessary. It also supplies conversons for point
alignment in arithmetic. It provides the descriptions for
intermediate results and validates composite of operands. It expands
corresponding verb forms, evaluates, inspects and others. It
probably has to restructure some statements, like those producing
both quotient and remainder, which are not suitable for direct
generation. It supplies the additional operators for things like the
rounded option amd provides the control flow ops for size error, at
end etc. It is typically left to solve the condition name /
abbreviated condition problem.
Lots more.
Bob> Naturally, the world is also invited to join in.
Naturally.
Bob> Best Wishes Bob Rayhawk RKRayhawk@aol.com
--
This message was sent through the gnu-cobol mailing list. To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body. For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.