12 ms·
fe: A tiny, embeddable language implemented in ANSI C
- bippingchip 3y agoI was wondering what the goal of the project is. The README is not very clear on it, but the implementation document [1] does state design goals: - Small memory usage within a fixed-sized memory region — no mallocs - Practical for small scripts (extension scripts, config files) - Concise source — less than 1000 loc - Portable ANSI C (Windows, Linux, DOS — 32 and 64bit) - Simple and easy to understand source - Simple and easy to use C API [1] https://github.com/rxi/fe/blob/master/doc/impl.md https://github.com/rxi/fe/blob/master/doc/impl.md
- LeifCarrotson 3y ago> - Portable ANSI C (Windows, Linux, DOS — 32 and 64bit) I skimmed through the source, and aside from reading a file from STDIN to a `static char buf[64000];`, nothing in this seems to use the POSIX API. With that buffer trimmed to an appropriate length, it appears it could run on a microcontroller, which is always a useful thing to have.
- jhvkjhk 3y agoThe author developed some games. Maybe the goal of fe is to write game scripts.
- frou_dh 3y agoDoesn't really count as language design if it's toy Lisp #9368. Language implementation exercise, yes.
- zokier 3y agoWho is counting?
- frou_dh 3y agoWell I counted 0 references to Lisp or Scheme in the documentation, so it seems to be presented as novel.
- masukomi 3y agoWhen you have methods named `cons` `car` and `cdr` that appear to work in the same way as lisp's methods of the same name it's pretty clear that you're not pretending or attempting to be "novel". While it _should_ say it's a lisp / scheme, given those it doesn't really _need_ to say that because it's pretty forehead slappingly obvious to anyone who knows what lisp or scheme are.
- striking 3y agoBut then if you call it a Lisp or even mention Lisp, some other wise guy is going to complain that it's not a real Lisp.
- haberman 3y agoEven if you don't mention Lisp, people will assume you were trying to make it a Lisp and complain that you didn't follow Lisp precedent. Examples can be found in this very comment section.
- kazinator 3y agoIt has cons cells, and lists terminated by a symbol whose name is nil. It's more of a Lisp than Clojure.
- baq 3y agoMe, I’m counting!
- kristianpaul 3y agoWondering how it compares to Lua
- zokier 3y agoAlmost two orders of magnitude smaller codebase.
- ideasman42 3y agoAre there any projects using this?
- stevekemp 3y agocel7 is a 60kb framework for making grid-based games limited to 4-bit color ASCII output. The framework is based around the fe programming language: https://rxi.itch.io/cel7 https://rxi.itch.io/cel7 There is a community edition which can be used, as the original is closed source: https://github.com/kiedtl/cel7ce https://github.com/kiedtl/cel7ce There is also "aq", a small framework for making audio toys: https://github.com/rxi/aq https://github.com/rxi/aq
- stevefan1999 3y agoJust another LISP clone...
- tm2t 3y agoYes, and? What's wrong with that?
- masukomi 3y agonothing's wrong with another lisp clone. the problem is with not being upfront about it. The problem is the implication that this is something new, that may solve some new problem in some new way. Now, it MAY do something other lisp clones don't, but if it does there's zero indication of it in the readme.
- linkdd 3y ago"new" when talking about a repository with 15 commits, the last one being 3 years ago. It is obviously a toy experiment and it took my 5s to realize that. While it does not say "this is a lisp", it also does not say "this is a new shiny thing that will change the world". In fact, it says nothing except "look at what i did".
- jacknews 3y agocar? cdr? bye!
- zeckalpha 3y agoWhat do you think HN is written in?
- jacknews 3y agolisp is great, I'm currently learning Janet, playing with fennel and clojure. But a new 'lispish' should not replicate ancient historical 'accidents', IMHO, and in fact lisp itself should deprecate these names (and caar, caadr, caaaddr ... OMG). first, rest, or head, tail, or whatever please.
- sirsuki 3y agoI once wrote a tiny DSL language. I used LISP (S-Expressions with parenthesis) because it semantically fit and made the parser much easier to write. I was laughed at and ridiculed by my peers. Everyone hated it that I had to attempt two other language styles just to compensate. I had a chuckle seeing fe syntax is LISP like and I was like “See? I’m not the only one.” Many just can’t give LISP and S-Expressions their due regard. Same for Reverse Polish Notation. I was born on the wrong planet.
- drpixie 3y agoI love RPN for calculating - I still regularly use a HP11C (Swiss Micros replica). But I hate coding or reading prefix (list) or postfix (rpn, forth, etc) languages. Once wrote a substantial project is Postscript - works fine but note easy on the brain. Guess it comes from just too much familiarity with infix notation!
- packetlost 3y agoI personally find prefix and RP notations to be pretty easy to read, but writing is harder for me. I've introduced bugs into FORTH programs because I did a + b instead of a b + out of habit. I think both notations have their place and not everyone will be able to make the switch
- nine_k 3y agoThere are Lisp macros that allow writing infix arithmetics. Even fe is said to support macros.
- lelanthran 3y agoNo you weren't, many of us, like myself, have designed small languages over the years. After a few of these, you stop designing syntax: you just skip the syntax and directly read ASTs instead of whatever syntax you wasted your time on. My next language is going to be a FORTH of some type .
- carapace 3y ago
- rurban 3y ago= for defun, really? why not set? = really is for equality in lisp, not assignment
- stefncb 3y agoWhy is it so strange that someone ignored a convention?
- deleted 3y ago[deleted]
- maleldil 3y agoBecause it's a 50-year old convention, and there doesn't seem to be a compelling reason for ignoring it. The language then uses `is` for equality, including numbers. It's just weird, especially given they're using old-fashioned car/cdr instead of head/tail.
- sph 3y agoThis is not a Lisp, and never claimed to be one. This kind of gatekeeping from ANSI Common Lisp purists is tiring. Who cares about convention when one just wants to build their own language, use S-exprs and car/cdr for the sake of it.
- maleldil 3y ago> Who cares Potential users care. It's off-putting to use something familiar but different in strange ways. Using head/tail versus car/cdr would be a deviation I could understand. This = mess isn't.
- chlorion 3y agoIt's not like common lisps practices are that great anyways. It being an old lisp convention, to me, is actually a reason to not follow it. I want to see a modern take on sexpr based languages instead of being stuck in the past forever.
- zogomoox 3y agoWhen I see amazingly compact language implementations like this, the effect on me is not 'I want to use this language' but rather 'I should also write my own LISP'.
- tjoff 3y agoI misread it as 'I should write my own LSP [for that language]', which might be neat project too!
- stevekemp 3y agoI wrote a lisp, a while back, and then later added an LSP for it. Since lisp is so simple in terms of syntax what I really did was tab-completion, and info-on-hover, for the built-in functions like "car", "cdr", and the primitives I added as part of a more complex standard-library. In my case I was writing in go and I found an LSP-server package which was trivial to use. So getting the integration with emacs, vim, etc, was really trivial: https://github.com/tliron/glsp https://github.com/tliron/glsp
- ranger_danger 3y agoStrange effect however I kinda felt it too. But alas `#include <setjmp.h>` here be dragons.
- mananaysiempre 3y agoUnless you want half your C logic to be error propagation, it’ll have to be <setjmp.h>, all its flaws notwithstanding. Manual unwinding can be done tastefully (see Tcl), but in the single-digit-KLOC weight class it’s not really a choice.
- fsckboy 3y agowhile we're marvelling about how small and compact it is, then just replace them (with something uglier and less performant), it's not rocket science
- bpierre 3y agoNot to be confused with Fe: https://fe-lang.org/ https://fe-lang.org/
- joeatwork 3y agoIf this project interests you but is a bit more minimal than you need, the Janet language is a slightly-less but still pretty lightweight embeddable Lisp with a strong library and community: https://janet-lang.org/ https://janet-lang.org/
- rychco 3y agoI just started toying with Janet recently & so far it’s very pleasant
- schemescape 3y agoHas anyone here switched from Common Lisp or Scheme/Racket to Janet? If so, what was good/bad about the switch? Or was it just different? I recently started learning Common Lisp, and it’s been mostly great, but my two complaints are 1) memory usage and 2) deployment (copy source or distribute a relatively huge world image—and I haven’t found any way to get a fully static build without patches, even with ECL). Janet could solve both of those, although I’d pay a performance penalty due to it being interpreted, and I assume there are a lot fewer libraries/tools. I really like the idea of a Lua-sized Lisp, but I’m not sure if I should jump ship from a traditional Lisp yet.
- baq 3y agoI’ve never done basically any lisp except a toy project but this > distribute a relatively huge world image in my understanding of the lisp world is actually a feature…?
- schemescape 3y agoYou’re right, it is a feature, but I’d like the option to distribute a smaller binary without everything built in. Roswell supposedly helps with this, but I haven’t gotten it to work yet. Some commercial implementations support this, I think, but they’re priced well beyond my hobby project budget. Janet is intriguing to me because it has a small footprint (even smaller than most Schemes). I’ve heard it’s handy for building little utilities, especially if you want someone else to be able to run them (a situation I find myself in regularly).
- wsc981 3y agoMaybe a little bit offtopic, but rxi also made a few Lua / LÖVE 2D libraries that I've been able to put to good use, namely shash [0], lume [1], json.lua [2] and classic [3]. He makes some nice stuff. --- [0]: https://github.com/rxi/shash https://github.com/rxi/shash [1]: https://github.com/rxi/lume https://github.com/rxi/lume [2]: https://github.com/rxi/json.lua https://github.com/rxi/json.lua [3]: https://github.com/rxi/classic https://github.com/rxi/classic
- vitiral 3y agocool a lisp clone. Good work. Could macros be used to add structs? How much code would this require? I don't feel like a language is real until you can associate data. It's literally the first thing I do when I start any software project that's not a five line script
- Iwan-Zotow 3y agoFemtolisp anyone? Use in Julia I believe https://github.com/JeffBezanson/femtolisp https://github.com/JeffBezanson/femtolisp
- deleted 3y ago[deleted]
- ComputerGuru 3y agoHere is as good of a place as any to ask: does anyone know of an embeddable scripting language pretty much exactly like Lua but with more C-like syntax? EDIT: the best alternatives I'd previously found were rhai (still niche and weak library) and sandboxed JS (heavier than I would like and the standard library is still poor).
- avgcorrection 3y agoI haven’t heard of that. Something that just compiles to Lua would probably be the easiest way to achieve that.
- vitiral 3y agoNot exactly the requirements your asking but you might be interested in the language I'm writing github.com/civboot/fngi
- xlo 3y agoMaybe AngelScript?
- alwaysbeconsing 3y agoMaybe Wren? It has classes and method syntax too but it's mostly C like: curly-braced blocks, operators are pretty much the same, slash and slash-asterisk comments, if/while/for with parens, ... Statements are not terminated by semicolons, though. https://wren.io/syntax.html https://wren.io/syntax.html
- schemescape 3y agoFor JavaScript, did you look at QuickJS? I believe the binary size is in the same range as Lua. The standard library isn’t terribly extensive, but I think it’s more comprehensive than Lua, no?
- kortex 3y ago> Donnie: I made a new language > Therapist: New language, or LISP dialect? > Donnie: LISP again Mostly a dig at the title. Jokes aside, I love how concise this is. Not sure how I feel about readability, too many inline if {} blocks for my liking, and a bit arcane. But I'm never not gonna upvote novel languages. Something about language creation delights me.
- beeforpork 3y agoThere's also ulisp (for Arduino projects etc.): http://www.ulisp.com/ http://www.ulisp.com/ This is larger, because there are functions for accessing peripherals, and the core is more standard lispy with 'caadr' et.al., and it has a compacting GC, so images can be saved as a compact blob.
- slmjkdbtl 3y agoi always go to rxi if I want to read some good concise c code, every one is worth reading
- deleted 3y ago[deleted]