5 ms·
Lemon – An embeddable, lightweight programming language in ANSI C
- 4lch3m1st 9y agoNot too much documentation nor examples there, right? However, the two test files and the documentation website immediately made me think about Python and Nim at the first glance. I might give it a try as an embeddable language, it looks promising.
- singularity2001 9y agoWhat a lemon
- rubyfan 9y agoLooks like a mashup of Ruby, JavaScript and tiny bit of Python.
- Hemospectrum 9y agoI’m mostly seeing a lot of Python. The examples show that multiple assignment unpacks collections, functions can be called with argument name assignment, and collections can be unpacked into named arguments, as opposed to using collections to replace named arguments.
- vidarh 9y agoRuby supports that too. Here's a snippet that shows named arguments, and unpacking a Hash into named arguments. It can do multiple assignment and unpacking collections into them too, though unlike with named arguments, that will treat the collection as an Array: def foo bar:, baz: p [bar, baz] end h = {bar: 1, baz: 2} foo(h)
- deleted 9y ago[deleted]
- jonathanstrange 9y agoWent to the doc directory and got this: TODO: Add Doc Could developers please stop doing that? These 'agile development' and 'release early and often' mantras have really gone overboard. Why would anybody use a programming language with zero documentation for anything? Are we supposed to guess the language and its features from a single five-line hello world program?
- _ph_ 9y agoIn all fairness: there seems to be a little bit more of documentation on http://www.lemon-lang.org http://www.lemon-lang.org So, whoever posted this to hacker news should have used that link rather than the GitHub link and of course, it seems to be way to early in development to post it at all. I have some quite unfinished projects of mine on GitHub, but I would never post a link to them until they are in a state where they would be relevant to a larger community.
- deleted 9y ago[deleted]
- exDM69 9y ago> Why would anybody use a programming language with zero documentation for anything? Are we supposed to guess the language and its features from a single five-line hello world program? As someone who has done a handful of compiler/interpreter projects: I don't think that they expect anyone at this point to be using that language. They're targetting it at language geeks like myself (who go and dig around the source, which I just did). Maybe in some years' time this project will reach a stage where end user docs matter. A little more verbose readme would have been nice, though. Things that I did not find out by looking at the examples/docs, but I care about: * what paradigm? imperative, functional, etc? * interpreted or compiled language? * what's the target? interpreter, a bytecode VM, LLVM, compile-to-C, native codegen? * static/dynamic typing? type inference? By looking around the code, I think that this is an interpreted language with dynamic typing that's implemented with a stack-based bytecode virtual machine. Not unlike Lua, Python or Ruby, that is.
- keithnz 9y agoseems a bit similar to lua? So little information it's hard to know what interesting things the language provides
- nodefourtytwo 9y agoWhat problem does it solve?
- baybal2 9y agoLooks like an attempt of a JS programmer to reinvent a lighter weight JS with aim at system programming. If it is yet again tied to a complex, feature rich VM (a stack based one), then he went the wrong way in achieving his goal. Direct interpretation should've been the way forward for such task.
- andrewchambers 9y agoA stack based VM or direct interpretation have no real difference with regard to what you mention. Please elaborate further.
- cond289123 9y agoYou are making very unnecessary comments..
- gvb 9y agoMy guess is a lighter weight (than Lua, Python, JS) embed-able language. A quick build creates a .so that is bigger than lua as reported below, but that is a naive and probably invalid comparison metric. make DEBUG=0 STATIC=0 USE_MALLOC=0 MODULE_OS=1 MODULE_SOCKET=1 ls -lh liblemon.so -rwxrwxr-x 1 guest guest 271K Oct 25 08:21 liblemon.so "Lua - Smaller footprint than Python. e.g. Look at the size of python22.dll, 824kb. A basic Lua engine, including parser/compiler/interpreter, but excluding standard libraries, weighs in at under 100kb." Ref: http://lua-users.org/wiki/LuaVersusPython http://lua-users.org/wiki/LuaVersusPython
- wahern 9y agoExcept liblemon is larger than liblua. $ ls -lh /usr/lib/x86_64-linux-gnu/liblua5.3.so.0.0.0 -rw-r--r-- 1 root root 219K Apr 13 2016 /usr/lib/x86_64-linux-gnu/liblua5.3.so.0.0.0 And that's with Lua having many more bindings--basically, all of ANSI C, including math and stdio interfaces. Lemon only seems to bind a dozen or so POSIX routines--see os.c and socket.c. There are other things that make it less suited for embedding than Lua. For example, Lua very carefully avoids touching any global process state. But one the very first things lemon_create() does it call srandom(). Those particular things, at least, could be easily remedied. Another reason why Lua is great for embedding is because of it's very carefully designed C API. With just a cursory look I can't tell how well Lemon compares on that score.
- otabdeveloper1 9y ago"Lemon – An embeddable, lightweight programming language in ANSI C that lacks documentation." Uh, thanks for posting this strange link, I guess.
- jlebrech 9y agoi'd like to see an embedded language designed to not have OO, and for the host system/language to handle the objects. I guess Lua 5.2 kinda fulfills that.
- bpicolo 9y agoWhy is the `var` keyword required in function arguments if it's dynamically typed and there's no other possible option?
- fasquoika 9y agoThis is a complete guess, but maybe so they can treat it the same way as normal variable declarations
- ateesdalejr 9y agoMight be. Probably reusing the same pattern matching code in function definitions.
- billytetrud 9y agoSo you don't create variables when you typo a variable name. Declarations are an error catching mechanism
- maxpert 9y agoInteresting mixture of C/C++, Python (__init__) and Javaish. Has no package manager (atleast I can’t see one). Would like to see how it compares against Lua in performance.
- wbhart 9y agoThe documentation [1] appears to come from a very ordered mind. There's something very appealing about simplicity. I see more similarity with Python than either Java or C, except for the braces and semicolons. The description says that everything is an object, even types, though there's no way to specify types in the function prototypes so far, it seems. (Whilst that is what you would expect from a dynamically typed language, it can still be useful for optional type checking, or for later optimisation (AOT or Jit), or to make it easier to efficiently add methods for existing "types".) Actually, what I can't quite see from the documentation is how one calls methods, whether it is necessary to put methods inside the classes, whether they dispatch only on the first argument or an implicit "this", and how inheritance is handled. So I guess this is all at a very early stage of development. [1] http://www.lemon-lang.org/documentation http://www.lemon-lang.org/documentation
- kobeya 9y ago> So I guess this is all at a very early stage of development. That should be the top link
- Semiapies 9y agoSubmitters here have developed a truly odd habit of posting a github link when a project has a site with actual documentation. And then, we get random, angry posters (visible elsewhere on this page) who don't notice the link to the actual site at the top of the github page.
- deleted 9y ago[deleted]
- exikyut 9y agoOr who think "if the github is in this state, the site's probably terrible!"
- shortstuffsushi 9y agoI'm seeing in the source that the author prefers type methodName(args...) Is this a common C-ism? I'm not familiar with this code style.
- mratzloff 9y agoGNU style. https://en.m.wikipedia.org/wiki/GNU_coding_standards https://en.m.wikipedia.org/wiki/GNU_coding_standards
- nachexnachex 9y agoIt is. It allows to search for function declarations with the regex '^[^( ]+[(]' (or similar) -- while more common in the past, many have adopted it and keep using it. Personally I've come to find it nice to read, particularly when you're returning complex, long types.
- deleted 9y ago[deleted]
- nurettin 9y agoInteresting optimizations: https://github.com/lemon-lang/lemon/blob/master/src/peephole.c https://github.com/lemon-lang/lemon/blob/master/src/peephole...
- sesteel 9y agoLooks like Python with curly braces. I assume the developer is also a python dev based on the comments in his code.
- robotresearcher 9y agoHow about this link instead, since the GitHub page has no info about the language? http://www.lemon-lang.org http://www.lemon-lang.org
- ateesdalejr 9y agoI agree. Maybe http://www.lemon-lang.org/documentation http://www.lemon-lang.org/documentation ?
- krylon 9y agoThe source code is very pleasant to read - both in terms of layout and variable names.
- cestith 9y ago> TODO: Add Doc It's not a programming language if there's no documentation. It's just a compiler implementation for a dialect of something amorphous and ethereal. That said, I kind of like the examples on http://www.lemon-lang.org/documentation http://www.lemon-lang.org/documentation and I wish the author(s) well in fleshing this out.
- geraldcombs 9y agoNot to be confused with SQLite's Lemon parser generator: https://www.sqlite.org/src/doc/trunk/doc/lemon.html https://www.sqlite.org/src/doc/trunk/doc/lemon.html
- ateesdalejr 9y agoNice seed for random number generation used here: https://github.com/lemon-lang/lemon/blob/9a0b3dbc854532b31f731a15f57365972d0cac73/src/lemon.c#L274 https://github.com/lemon-lang/lemon/blob/9a0b3dbc854532b31f7... I'm not sure because I haven't read very far yet but I wonder if the lemon standard lib allows lemon code to change the seed?
- billytetrud 9y agoWhat's the motivation for this language? It seems like Javascript with destructuring assignment, named function parameters, and a few miner quirks (like sentinal)
- khedoros1 9y agoIt seems like it's meant to be easy to embed in another language's code. Like embedding LUA into a C game engine to provide a convenient way to build higher-level game logic on top of the engine.
- sli 9y agoJS has destructuring assignment and named function parameters can be emulated, sorta, with parameter destructuring.
- ateesdalejr 9y agoLooks like the documentation website is down right now.