Why is there no or or and ?
Paul D. Anderson
paul.d.removethis.anderson at comcast.andthis.net
Fri Feb 17 14:32:44 PST 2012
On Friday, 17 February 2012 at 20:52:56 UTC, F i L wrote:
> H. S. Teoh wrote:
>> Are you referring to:
>>
>> int x = 10;
>>
>> vs.
>>
>> x = 10;
>>
>> ?
>>
>> In that case I would still prefer :=, since the first can be
>> thought of
>> as shorthand for "int x; x := 10".
>
> I'm not sure what you're asking/saying here. What I mean is
> that there needs to be some distinction between variable
> declarations and variable assignment.
>
> Foo: class
> {
> x: int
>
> // lots of code
>
> bar: void()
> {
> x := 0 // set Foo.x or create a local 'x' variable?
> }
> }
>
>
>>> I don't think lines need ending marks at all.
>>
>> This leads to ambiguity problems if it's unclear whether two
>> adjacent
>> lines are a single statement or two. It also makes the grammar
>> much
>> harder to implement in a parser, because it can't easily tell
>> between
>> the end of a statement and a wrapped line. Having a statement
>> separator
>> is a good thing.
>
> I don't think this leads to ambiguity problems, I've thought
> about this before and can't come up with any that aren't easily
> addressed. Also, I don't think is much harder to parse at all,
> just when the statement is determined to stop needs to be
> slightly more intelligent. If we can understand the code
> without ending-marks, a compiler should be able to understand
> it as well. This is something I'm experimenting with at the
> moment with LLVM.
>
>
>> Wait, you're trying to reimplement D syntax??
>
> Nothing so robust. Mostly I'm playing around with compiler
> design while refreshing my C++ abilities (which it's been
> awhile). My main focus is to try and build a simplistic
> compiler around the concept of having an AST designed to stay
> in memory and be dynamically submitted changes and on-demand
> compilation (like NRefactory, or MS Roslyn). Kinda like and
> interrupter only designed with the goal of 1) Non-text forms of
> manipulation and logic construction, and 2) modularized AST
> libraries as development reflection tools (think objects
> overview, code-completion, etc).
>
> I'm thinking of textual syntax as more of "commands" to submit
> AST nodes, so there's no real "syntax" beyond what's saved in a
> file, which isn't really suppose to be humanly read/written
> though a traditional text editor. I think "standard tools" (+
> modularized to used by other tools) are as important as
> standard libraries.
>
> Just a hobby :)
http://en.wikipedia.org/wiki/Forth_%28programming_language%29
More information about the Digitalmars-d
mailing list