unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
[parent not found: <cmu-lmtpd-30052-1206637626-0@mail-imap1.uio.no>]
* Guile Summer of Code project
@ 2008-03-20 10:12 Luis Araujo
  2008-03-24 23:40 ` Neil Jerram
  2008-03-26 20:52 ` Ludovic Courtès
  0 siblings, 2 replies; 8+ messages in thread
From: Luis Araujo @ 2008-03-20 10:12 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

Hello everyone , how are you?

Considering that the GNU project is participating on the google summer 
of code of this year, I am wondering if we could probably get a nice 
Guile/Scheme project onto it.

Here I send a brief and general proposal about my project, a Guile C 
Parser. A parser written on Scheme hooked up into Guile for parsing C files.

As I said, it is a very brief proposal, so, many implementations details 
would still need to be figured out or might change on the road, but I 
think it is detailed enough as to show what I am after with it.

Please let me know if you are interested on further information,

Thanks and Regards,

[-- Attachment #2: GCP_guile.txt --]
[-- Type: text/plain, Size: 5557 bytes --]

-- Title: Guile C Parser (GCP)

-- What is GCP?

GCP as its name stands, it is a parser for ANSI C code written on Scheme 
to be included into Guile. 

The main idea is to represent in a structured and modular way all the components
of a C source file into Guile. 

This tool would allow to easily parser C headers files and generate 
automatically Guile interfaces for their libraries among other things.

-- Design and Development

My initial idea is to give an object representation of a C source code file
from Guile, and implement from there on, functions and data types , probably
using GOOPS for many of this representation for easy handling of the C code
from Guile itself.

Briefly and general explained the project will consist initially of 
the following Scheme modules:

    c-parser.scm:
	This module contains the main Scheme procedures for parsing C code.
	It should be an easy interface from the user point of view, though
	very powerful in the other hand, because it will implement the core
	parsing operations.

	For example, we can have a main entry function for the whole parser
	called:

		(define (parser-c <string>)
			...)

	This function would take a single string value containing a proper C code
	program or file and will be the responsible of building the complete AST 
	for the code returning either a:
		a -  GCP data structure. Something like an abstract syntax tree
		wrapped around data structures to ease handle (we could 
		probably use GOOPS here).
		
		b - An error message or structure spepcifying failure of
		parsing.

	We could also include in this module handy things like for 
	example, different parsing modes for a C standard or language extension.

     c-lexer.scm:
	This module could be included in certain extent into c-parser.scm ,
	nevertheless , considering the nature of the project and given the
	representation I want to give to each components , I will probably have 
	to implement a lexer offering some kind of object representation
	for tokens, so it probably make it worthy to have it in a different
	file.

	It will contain also a main entry function like:

	   	(define (lexer-c <string>)
			...)
	
	Taking a string of proper C code, and returning lexems probably 
	wrapped in somekind of data types. It could also return a lexical error.

	This function and module could be also used standalone , but practically
	will be invoked from c-parser.scm through parse-c.
	
     c-syntax.scm:

	This module will contain the whole ANSI C code abstract syntax described
	and represented in terms of Scheme structures. For example,
	we can have here defined objects for the different C statements 
	(if, while ..) , the different structures (struct , enum ...).

	It will also be the module containing a representation of all the
	available standard ANSI types.

	In general, this module will offer the mapping between the C 
	syntax and its Scheme equivalent, among the necessary data structures
	(abstract data types/objects) to be handled by the rest of the modules.
 
     c-pretty.scm:

	This module will contain the fuctions to 'pretty print' output
	of the parser and lexer. It might also contain functions for proper
	visulation of the data structures of the syntax representation on
	Scheme.

     c-misc.scm:

	It will contain extra functions and objects. For example, we can
	add here routines to extend the parser, like parser-c that instead
	of taking a string value would take a whole file or C program directory,
	it can also containg Guile-specific extensions.

-- Timeline:

   Considering the previous brief and general description of this project,
   I will take a schedule similar to the following:

     	   - I would start designing the c-syntax.scm module, this could
	   take big part of the time , probably around  3 weeks, and it should
	   be in my opinion the first module, since it will contain the main
	   design desicions affecting the rest of the modules operations.
	   All the data structures handled by the rest of the program will
	   be described and implemented here.

	   - In 2 weeks could be greatly implemented the whole lexer.

	   - The parser will be the more complex and time consuming task.
	   I expect that its development takes at least 1 month and a half.

	   - The modules c-pretty and c-misc , depending of the needs could
	   take longer than expected, but something basic and usable 
	   accomplishing their main functions could be done in around 3 weeks.

After this time, we should be able to have a very usable parser and framework,
that we can hook into Guile and start using very straight-forward.

-- Technical details:

   I would fully implement this code using latest 1.8 Guile version
   (by the time of this writing 1.8.4).

-- Community benefits.

   Scheme is a small programming language , with a very loyal community
   who has been able to deploy Scheme through many fields.

   Guile is a particular Scheme project intended to make available such a
   language as an embeddable library into other applications, mainly 
   coded on C.
   
   Therefore, being able to parse and access C code from Scheme/Guile itself,
   and handling such a code like any other Scheme object would clearly 
   benefit the community opening many new possibilities.

   For example, creating Guile bindings through a foreign function generator
   using the parser on headers for popular C libraries and applications
   would be plain easy.

   This project can also greatly help with the internals, analyzing and
   checking proper C code using Guile.


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

end of thread, other threads:[~2008-03-27 17:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cmu-lmtpd-31700-1206464752-1@mail-imap1.uio.no>
2008-03-25 17:19 ` Guile Summer of Code project Kjetil S. Matheussen
2008-03-25 17:47   ` Kjetil S. Matheussen
2008-03-25 21:45     ` Neil Jerram
     [not found] <cmu-lmtpd-30052-1206637626-0@mail-imap1.uio.no>
2008-03-27 17:36 ` Kjetil S. Matheussen
2008-03-27 17:57   ` Kjetil S. Matheussen
2008-03-20 10:12 Luis Araujo
2008-03-24 23:40 ` Neil Jerram
2008-03-26 20:52 ` Ludovic Courtès

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).