Description of the language

126 views
Skip to first unread message

Stefanos

unread,
Oct 25, 2017, 10:39:03 AM10/25/17
to lemon-lang
First of all, 

Thank you for inviting me to the mailing list.

As I have asked a couple of questions on GitHub, I would like you to thoroughly explain to us the reasoning behind the decision or expand the answers you provided on my questions.

I want to know as much as possible about the language.

Keep up the good work.

Regards,

Stefanos


admin

unread,
Oct 25, 2017, 4:32:43 PM10/25/17
to lemon-lang
Hi,

Thanks for try Lemon, I'd simple explain what's Lemon is and what's it used for.

The Lemon is a very simple and small language, syntax most come from C/C++ and Java, Lemon also used a lot of Python's design.but different of others, Lemon will prefer use **function** instead syntax, like yield() and callcc() are both function, It's in the object system. not language, to keep language stable.

The most useful of Lemon is It's can be C's DSL, I used lemon in C project, everything is hard implementation in couple of line C or without GC. As you can see lemon has a very simple C interface, can easily call from C also can easily wrap a C function to lemon.

The implementation of Lemon has two separate part:
1, The Language, parser, compiler, virtual machine, collector, etc.
this part of code is very simple and easy understand, filename is the name of part.I'll keep this part of code very simple and tight.

2, The Object System.
Everything in source code start with 'l' is object(except lemon.c and lexer.c).The core of object only required 1 structure and 1 function.Lemon almost expose every import structure to user,like lframe.c it's the virtual machine's call frame.I made it a standard object, that's why I can simply implementation yield and callcc in function way.

Stefanos

unread,
Oct 25, 2017, 4:44:05 PM10/25/17
to lemon-lang
Excellent.

Will you continue using C89 syntax? Won't this limit you to 32-bit support if you plan to go fully portable? I know GCC supports 64-bit as GNU extensions, but I don't think you would want to use extensions, unless I'm wrong.

C99 supports 64-bit by standard and would help a lot; even Python switched to C99 now.

If you care about multiple platform support though, I guess you will have to stick with C89 which can be found everywhere.

admin

unread,
Oct 25, 2017, 4:59:58 PM10/25/17
to lemon-lang
Yes, most of code is C89, but use some C99 feature like intptr_t. I think C89 is support 64bit as well. so I will continue use C89.
The whole source code shouldn't use any compiler's extensions.

Stefanos

unread,
Oct 25, 2017, 5:03:57 PM10/25/17
to lemon-lang
In the form of extensions, yes; but officially no.

After C99 release types such as long long and unsigned long long became supported by the standard.

admin

unread,
Oct 25, 2017, 5:14:44 PM10/25/17
to lemon-lang
ANSI C standard only defined least size of type, not largest.In LP64 model long type is 64bit.

Stefanos

unread,
Oct 25, 2017, 5:33:49 PM10/25/17
to lemon-lang
I didn't know that.

Thanks for letting me know.

I guess I still have so many things to learn around C...
Reply all
Reply to author
Forward
0 new messages