unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* DXL mode
@ 2011-02-14 22:05 Vincent Belaïche
  2011-02-15 17:26 ` Stefan Monnier
  2011-08-22 12:43 ` Bryan
  0 siblings, 2 replies; 3+ messages in thread
From: Vincent Belaïche @ 2011-02-14 22:05 UTC (permalink / raw)
  To: emacs-devel; +Cc: Vincent Belaïche

Dear all,

I could not find any edit mode for DXL, if this does not exist, I will
probably create one.

I am wondering what is the best way to start from. DXL is Doors(TM)
eXtension Language. Doors is a data base system used in the industry to
write specifications with easier requirement management.

DXL looks like C to many aspects, and I thought that it may be a good
idea to add one more C dialects to the list in the cc-mode
package. However by some other aspects its syntax can be made quite
different. 

This is why I am seeking guidance on this forum before starting
anything.


Currently I am using the C mode to write DXL code, which obliges me to
write it as much in a C-like manner (for instance I need to end all
statements by a semi-colon), but I would like to get rid of these
constraints, and have some programming mode that would indent correctly
any kind of DXL code.

The main differences from C syntaxe are the following ones:

Predefined types
----------------
you don't have any `float' or `double' or `long int', but there are a
number of predefined types like `bool', `int', `real', `string',
`Array', `Skip', `Link', `Object', etc...

Qualidiers
----------
the only one is `const', and AFAIK it must be always in the first
position:

const int i = 3 // OK
int const i = 3 // not OK

End of statements
-----------------
In DXL statements do not need a tailing semi-colon, an end-of-line is
sufficient. You may have several statements in a line provided that they
are separated by a semi-colon, and statements can also span over several
lines: the DXL interprete detects that an end-of-line does not
terminate a statement if one of the following two conditions is
fulfilled:

+ the line is ended by an empty comment `//', or by a comment with a
  tailing `-' like `// blah blah -'

+ the statement would otherwise contain some incomplete construct
  (e.g. opening bracket that is not closed, or stuff like that)

Ranges
------
there is a range construct like this `FROM : TO by STEP' or `FROM : TO'

Functions
---------
Function calls do not need necessarilly brackets, the 3 following
expression give the same result:

real f0 = sqrt 2 // naked
real f1 = sqrt(2) // à la C
real f3 = (sqrt 2) // à la Lisp

The brackets are needed when there are more than one argument, so you
cannot always write things à-la-Lisp.

Personnally when a function call with a single argument is within an
expression I prefer the à-la-Lisp way to avoid any precedence issues,
but when it is the rightwing of a `=', then I let it naked.

An example why I prefer to do this way is for instance

1: string a="xxx"
2: print length(a) "!" "\n"
3: print (length a) "!\n"
==> 4
==> 3!

On the second row you take the length of `a' concatenated with `"!"', so
it makes `4' which is then stringized and concatenated with `"\n"'. This
is quite confusing if written this way.


Special construct
-----------------
you have this:

for ... in ... do  ... 

and also 

if ... then ...

is possible in addition to

if ... { ... }

in the case that the expression following `if' does not start with a `('

-----------------------------------------------------------------------

I am seeking guidance, based on the preceding information, on whether
I would meet any dead-end issues if I try to add a C dialect to cc-mode
(like awk which also does not always need ending semi-colons), or if it
seems feasible with a reasonable effort.

If adding a dialect to cc-mode is not the good way, then I would rather
re-start from scratch by reworking some simple existing mode, like the
visual-basic-mode which is the one I know best.


VBR,
   Vincent.
  





 














^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: DXL mode
  2011-02-14 22:05 DXL mode Vincent Belaïche
@ 2011-02-15 17:26 ` Stefan Monnier
  2011-08-22 12:43 ` Bryan
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2011-02-15 17:26 UTC (permalink / raw)
  To: Vincent Belaïche; +Cc: acm, emacs-devel

[ Added Alan to the Cc since IIRC he's having trouble receiving the
  mailing-lists's email. ]

> DXL looks like C to many aspects, and I thought that it may be a good
> idea to add one more C dialects to the list in the cc-mode
> package. However by some other aspects its syntax can be made quite
> different. 

Hopefully Alan can help you out.  IIUC cc-mode has been (and/or is
being) improved to make it easier to use it as a generic engine, so
it's probably a good idea to try and use it.  The semi-colon issue you
mention should not be a problem since awk has the same kind of behavior
but is also supported by cc-mode's engine.


        Stefan



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: DXL mode
  2011-02-14 22:05 DXL mode Vincent Belaïche
  2011-02-15 17:26 ` Stefan Monnier
@ 2011-08-22 12:43 ` Bryan
  1 sibling, 0 replies; 3+ messages in thread
From: Bryan @ 2011-08-22 12:43 UTC (permalink / raw)
  To: emacs-devel

> 
> If adding a dialect to cc-mode is not the good way, then I would rather
> re-start from scratch by reworking some simple existing mode, like the
> visual-basic-mode which is the one I know best.
> 
> VBR,
>    Vincent.
> 
> 

Vincent,

did you make any progress with this effort?

~Bryan





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-22 12:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-14 22:05 DXL mode Vincent Belaïche
2011-02-15 17:26 ` Stefan Monnier
2011-08-22 12:43 ` Bryan

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).