Path: news.daimi.aau.dk!news.daimi.aau.dk!eernst From: eernst@quercus.daimi.aau.dk (Erik Ernst) Newsgroups: comp.lang.beta Subject: Re: a few basic questions Date: 04 May 1995 00:17:01 GMT Organization: DAIMI, Computer Science Dept. of Aarhus Univ. Lines: 107 Distribution: world Message-ID: References: NNTP-Posting-Host: quercus.daimi.aau.dk In-reply-to: bakul@netcom.com's message of Sat, 29 Apr 1995 01:00:41 GMT In article bakul@netcom.com (Bakul Shah) writes: I have been reading the Beta book (Object-Oriented Programming in the BETA Programming Language) and have some questions. I looked though the Beta FAQ and various publicly available on-line sources but did not find answers to these quesions. 1. Are Beta identifiers case sensitive? No. (Exception: names of externals are case sensitive in cases like someFunction: external(# in,out: @integer enter in exit out #); where there is no "do 'someFunction'->callC" or similar to specify the name of the function to call. In this case the name of the external is used as the default name of the called function). 2. Are Beta keywords case sensitive? In various sources I have seen `INNER' as well as `inner' which leads me to believe may be they are not. No, they are not. 3. What characters are allowed in identifiers? More generally, grammar described in the appendix A of the Beta book does not give any syntax rules for terminals symbols such as identifiers and numbers. Identifier = {'a'-'z','A'-'Z','_'}{'a'-'z','A'-'Z','0'-'9','_'}* LiteralInteger = {'0'-'9'}+ | '0' ('x'|'X') {'0'-'9','a'-'f','A'-'F'}+ LiteralReal = {'0'-'9'}+ '.' {'0'-'9'}+ | {'0'-'9'}+ ('.' {'0'-'9'}+)? ('e'|'E') {'0'-'9'}+ I hope this notation is readable even though it is not quite standard---unquoted parentheses are used for grouping, and braces are used to construct sets; '+', '*', and '?' are the usual regular language constructors; '-' constructs ranges of characters; so only the quoted characters appear in the resulting strings. Of course, 'Identifier' is really the set of strings specified above _except_ the set of reserved words in all possible mixtures of lowercase and uppercase letters. 4. Syntax for the If-imperative does not specify (if E then I if) as valid but I have seen this syntax used in a number of examples elsewhere (i.e. not in the Beta book). Which is right? The "simple if-statement" has been introduced after the BETA book went to press. It also allows an else-part, ::= '(' 'if' 'then' ( 'else' )? 'if' ')' 5. Page 62 shows two forms for labeled imperatives. The second form ``(L: Imp1; ... :L)'' does not match what is in appendix A. I suspect appendix A is wrong. Also, what is the `scope' of a label? For example, is ``(L: (L: 1 :L) :L)'' valid? ``(L: Imp1; ... :L)'' has been removed from the language. One can always use ``L: (# do Imp1; ... #)'' to the same effect. This even generates quite efficient code as long as the inserted object '(# .. #)' has no prefix and declares no attributes of its own. 6. I am curious about why Beta only allows one dimensional arrays. Why is col:(# cell: [columns] @real #); m1: [rows]@col preferable to m1:[rows][columns]@real ? I don't think the first one is preferable, just easier to implement and specify (just think about something like ``234554->m1.extend'' or would we allow ``234554->m1[17].extend''?). It's tedious to have to write it as it is now and to use it like ``m1[2].cell[3]'', so perhaps some nice, clean extension to arbitrary-dimensional repetitions will be proposed (and hopefully implemented right after that :-). I realize that the Beta book is not a formal language reference so please don't think of the above questions as a criticism of it. I am simply curious. Me too! So what kind of information have I actually supplied here? Just the kind of information available to any person with access to the Mjølner implementation of the language. It might be wrong, or it might be correct, when talking about _the language_ BETA. It does seem to be in line with the behaviour of the Mjølner BETA compiler, though, and it somehow seems "reasonable" to me. On the other hand, I think these questions are very good demonstrations of the fact that we need a concise language reference manual, so that questions like these will have a definite answer. One never knows, such one might just turn up ;-) cheers, -- Erik Ernst eernst@daimi.aau.dk Computer Science Department of Aarhus University, Denmark