Re: CASE...ENCASE Query...



On Jan 10, 2:57 pm, Rob Kendrick <n...@xxxxxxxx> wrote:
No, you use the same compiler for EVAL.
[snip]
Once you've got one compiler and semantic checker, you reuse it.

Probably not, in practice. A 'syntax and semantic checker' designed
for use at the 'compilation' stage will have very different design
considerations from one which has to be part of the 'run-time engine'
and which therefore has a direct bearing on executable size and
execution speed.

The former would want to be as thorough as possible, given that
execution time and code size are (substantially) irrelevant. The
latter would need to be as compact and fast as possible, and would
probably carry out only the minimum amount of checking necessary to
prevent a crash.

To me, the later of these is more obviously solvable, and yet is
the one that generates the error.

In processing a constant (quoted) string BBC BASIC copies each
character from the string into some buffer and stops when it
encounters the 'closing' quotes. In the event of the closing quotes
being missing, it could in principle keep going indefinitely, until it
encounters 'unreadable' memory and crashes catastrophically.
Therefore a test of some kind is essential, and once the test is in
place reporting an error is the obvious course of action.

Once you include all this, as well as unwinding the stack etc, it's
more overhead than none.  No?

You've forgotten what you once knew about BBC BASIC! There is no
'unwinding of the stack' when an error occurs (except in the special
case of ON ERROR LOCAL). Anyway, nobody was talking about the
overhead of *processing* an error, but the (claimed) overhead of
*checking for* the (assumed non-existent) error.

What I meant was that Moshen's compressed hardest, but most of the time
I used !BC, which didn't crunch as well, but it was a lot faster, and
had an excellent syntax checking system in, thus letting you discover
bugs before you even run the program.

An offline syntax checker would definitely be an asset to BBC BASIC.
I've put a hook into the latest version of the BB4W IDE so that if
anybody cares to produce one it can be integrated into the package.

Richard.
http://www.rtrussell.co.uk/
To reply by email change 'news' to my forename.
.



Relevant Pages

  • Re: Handling error/status messages by interface to C++ programs
    ... about how to design a compiler, please tell me where I can find ... exceptions for managing the error detection is rather a bad idea. ... I have to say I have seen a simple example of an object-oriented parser design in some book (unfortunately I forgot ... It would trigger user notification and do recover housekeeping like reseting the current syntax row's token stack because one wants to continue parsing and detect any other errors w/o aborting. ...
    (comp.object)
  • Re: Is Forth suitable for writing compilers?
    ... used to your syntax won't mind at all. ... need extra complexities in your compiler design too. ... Albert van der Horst, UTRECHT,THE NETHERLANDS ...
    (comp.lang.forth)
  • Re: How to test if an enum is inside a set
    ... > not how it is designed to be easy for the compiler ... compiler design. ... that delphi doesn't allow you to write something like this ... Perfectly valid syntax in C/C++. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: CASE...ENCASE Query...
    ... Once you've got one compiler and semantic checker, ... for use at the 'compilation' stage will have very different design ... execution time and code size are irrelevant. ...
    (comp.sys.acorn.programmer)
  • Re: Equals Operator
    ... Much of the syntax is taken from C/C++ design. ... compiler. ...
    (microsoft.public.dotnet.languages.csharp)