[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] need idea for read-syntax
From: |
Category 5 |
Subject: |
Re: [Chicken-users] need idea for read-syntax |
Date: |
Sat, 15 Nov 2003 11:18:43 +0000 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (berkeley-unix) |
felix wrote:
> Hi, all!
>
> I would like to add a read-syntax for embedding C code into
> expressions (as opposed to embedding it into the program itself, like
> "#> ... <#"). It must be possible to specify C code, with an optional
> type specification.
>
> So far I have just come up with something like:
>
> #>"doSomeInitStuff();" ; embed statement (no type given)
>
> (print #>"my_version_string" : c-string) ; embed expression (type given)
Hmmn! Interesting challenge. I played with this for a while and the
most promising syntax I was able to come up with was:
statement: #[ doSomeInitStuff(); ]#
typed expression: #[[c-string] my_version_string]#
I think the significance of C embedding justifies the use of #[...] and
most other syntax overloads or overcomplicates. From a parsing point of
view you always know that #[ starts some inline C and it's easy to then
check for the #[[ to tell a typed expression from a statement. It's
also helpful for expression readability to see the type first.
I'm a bit unclear on the statement case, though; what's the return value
of an inline C statement? Do you intend to allow for just one statement
or a sequence of them? If sequences of statements are allowed, this
seems pretty similar to #>...<#, apart from program context.
--
- [Chicken-users] need idea for read-syntax, Felix Winkelmann, 2003/11/14
- Re: [Chicken-users] need idea for read-syntax,
Category 5 <=
- Re: [Chicken-users] need idea for read-syntax, felix, 2003/11/15
- Re: [Chicken-users] need idea for read-syntax, Peter Wang, 2003/11/15
- Re: [Chicken-users] need idea for read-syntax, Felix Winkelmann, 2003/11/17
- Re: [Chicken-users] need idea for read-syntax, Peter Keller, 2003/11/17
- Re: [Chicken-users] need idea for read-syntax, Felix Winkelmann, 2003/11/17
- Re: [Chicken-users] need idea for read-syntax, Peter Wang, 2003/11/17
- Re: [Chicken-users] need idea for read-syntax, Category 5, 2003/11/16
Re: [Chicken-users] need idea for read-syntax, Category 5, 2003/11/18