Re: extended operators




"Charlie Gordon" <news@xxxxxxxxxxx> wrote in message
news:4740a910$0$30944$426a74cc@xxxxxxxxxxxxxxx
"cr88192" <cr88192@xxxxxxxxxxx> a écrit dans le message de news:
9d788$473ed1e0$ca8010a3$6731@xxxxxxxxxxxxx

"Douglas A. Gwyn" <DAGwyn@xxxxxxxx> wrote in message
news:473E5252.70A3E0D2@xxxxxxxxxxx
Charlie Gordon wrote:
C-- is tempting, but already has several failed incarnations.

Maybe C+- ?

No, this one would not reflect the spirit: first simplify C by removing
the historical crud, then extend it with modern useful stuff. It would
have to be C-+ but it is not sexy ;-)


maybe.

if I were to change a few things about C (making an essentially new,
C-derived lang):
removing the expected support of K&R style declarations;
make prototypes mandatory, at least for external functions, that or add in a
different means for managing shared code (such as a module system);
limit the syntax to only 1 prototype per declaration;
maybe, try to find a way to make parsing context-independent;
find some less horrid syntax for function pointers, and for returning
function pointers;
maybe more clearly splitting out what is part of the declaration and what is
part of the type;
....

however, this would break most backwards compatibility, but oh well...

the language would probably end up looking something like a hybrid between C
and Java.

examples:
import foolib.*; //java-like import notions

int(int)* fp; //this is a function pointer...
vs:
int (*fp)(int);

likewise, for returning said pointer:
int(int)* bar();
vs:
int (*bar())(int);

likewise, such a syntax can be handled linearly, without turrning quite as
horrid:
int(int)*(int)* bar();
vs:
int (*(*bar())(int))(int); //or, however the hell this would go...


in this system, maybe make the type itself is a fully atomic unit, and not a
fused in part of the declaration.

so:
int[64] a, b;
vs:
int a[64], b[64];


context independence, if added, would require either eliminating typedefs,
of for finding a different way to manage them. one example would be to make
typedefs behave similarly to macro-expansion, rather than semantic.

another way would be to find some context-independent way of identifying
types...

an example would be to make it part of statement parsing:
<typename> <name> ...
<typedecl> <name> ...
....

are recognized as declarations.
this case will be recognized if:
in statement context (not part of a sub expession);
is not recognizable as some other valid expression or statement type.

typedecl could be potentially recognized explicitly:
modifier=static | const | ...
specifier= <args_list> | <array_bounds> | '*' | '&'
typedecl=<modifier*> <typename> <specifier*>

aka: anything that looks like a declaration, is assumed to be one by the
parser.

this does limit a few things, for example:
a*b;

is libable to be parsed as a declaration, weather or not 'a' is a visible
type (nevermind that cases like this make little sense).

"(a*b);" would still be an expression though.


failing this, one can live with the context dependency.

and so on...


C$
C%
C^
C&
C*
C_

or, maybe this:
C?

do you use C!
were you @C?
dos boot @C.
...

semantic thoughts:
C? implies "well, maybe it is still C".
no, "C!", could be C with Erlang-style concurrency mechanisms tacked on.

C_ could be sort of like C#, but so named because it falls a little
flat...

You really like operators, don't you?

C* does have appeal.


maybe...


and endless other possibilities...

Yes:

C:
C:\
C:>
C~
C~~
red-C
\C
|C|
<C>
C<
C>>


hmm:
C:\>
dos boot?...
nine.
dos command prompt?...
jaw.
....


I like C* best, it is not used to name a computer language yet.


maybe...


--
Chqrlie.



.



Relevant Pages

  • Re: A Grammar Writing Question
    ... complicate the separation of lexing and parsing. ... declaration) from a function call. ... the final context. ... Jim worked through these examples and developed a grammar ...
    (comp.compilers)
  • Re: JavaScript global object
    ... Variables should always be declared using a var statement. ... When control enters an execution context for eval code, ... However, because the function declaration is evaluated using eval, it doesn't exist until execution of that function call. ... The variable, TestEval2, does not exist anywhere within the scope chain of the EvalCode function, therefore assignment will proceed by creating a new global variable, and assigning to it a reference to the new function object. ...
    (comp.lang.javascript)
  • Re: "static" question
    ... > I would like to know what is the meaning of: ... That depends on the context of the declaration. ... lifetime; for a class it is a single variable instead of a member variable in ...
    (comp.lang.cpp)
  • Re: How to access a static member variable within __asm { }
    ... Show the declaration, the context in which you are writing the __asm insertion, and the ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: "static" question
    ... > That depends on the context of the declaration. ... > means that v has internal linkage, i.e., in practical terms, is not ...
    (comp.lang.cpp)