RSS 2.0

Personal Info:

Joe Send mail to the author(s) leads the architecture of an experimental OS's developer platform, where he is also chief architect of its programming language. His current mission is to enable writing large-scale software that is reliable, secure, and scalable by-construction. Before this, Joe founded the Parallel Extensions to .NET project. He has been granted 19 patents, with 49 pending. When not working, Joe enjoys travelling with his wife, writing books, writing music, studying music theory & mathematics, and doing anything involving food & wine.

My books

My music

Disclaimer:
The content of this site are my own personal opinions and do not represent my employer's view in anyway.

© 2012, Joe Duffy

 
 Tuesday, August 24, 2004

As Nick pointed out in response to my previous post, the syntax I baked up for DbCiC (”Deb Kick”, clever eh?) is fairly poor. Not only is it ugly, but expressing pre-/post-conditions pertaining to things other than return values and parameters - a fairly common case - is not very trivial to acheive. (Hey, I was tired!)

I am leaning towards the following BNF (left-recursive) grammar:

<Contract> : <RequireClauses> <EnsureClauses>

<RequireClauses> : nil | requires <RequireClause>

<RequireClause> : <BooleanStmt> | <RequireClause>, <BooleanStmt>

<EnsureClauses> : nil | ensures <EnsureClause>

<EnsureClause> : <BooleanStmt> | <EnsureClause>, <BooleanStmt>

My example from my previous post would look like this:

  int divide(int a, int b)

    requires b != 0

    ensures [return] == a / b

  {

    return a / b;

  }

Yes, I did shamelessly pilfer Eiffel's keywords as I find that they are clear, unambiguous and improve readability. It is slightly more verbose, but this is a GoodThing(tm) IMHO.

At this point, I have a pre-compilation app that simply parses and expands the tokens into the desired result (almost done, code will be posted once it's 100%); I am also playing with an extension to the (Rotor) C# compiler, but there's something attractive about having this decoupled from the actual compiler implementation. Source line #-to-IL mapping for debug purposes would be challenging without compiler support, however, necessitating some post-csc IL/PDB patching to remap lines back to the original source.

 

Recent Entries:

Search:

Browse by Date:
<August 2004>
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234

Browse by Category:

Notables: