I have added

extern "C" cstatement
extern "C" { cstatement+ }

to the grammar. This allows you to write any C89 code directly in Felix
with the following caveats:

0) There is no pre-processor!

1) At present typedef names aren't handled. This requires tracking in the
parser and a special production. TBD.

2) At present the code doesn't do anything. It's just parsed. 

3) Bad C that happens to conform to this particular grammar will be accepted.

4) Due to laziness, C code currently uses *Felix* literals and identifiers,
not C ones.

The intention is to allow you to write C instead of Felix to specify bindings
and also you can write some C functions this way instead of using
"body". This will require quite a bit more work actually decoding the
code.

There is little hope of extending this mechanism to real C++. The problem is
that name lookup in C is simple: type names are just stored in a list.
In C++ you have a lot of namespace crud, which means a real lookup
is required to discover if a name is a type name. However we might be
able to support a subset of C++. Anyhow this parses:

extern "C" void f(int);
extern "C" void g( int *a);

extern "C" void f(struct X a') { return """xxx"""; }
extern "C" { 
  void f(int);
  static int x;
  static int y = 1;
  void f(int);
}

println "Done C";

--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to