guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

s-expressions, c, css and javascript


From: tantalum
Subject: s-expressions, c, css and javascript
Date: Wed, 07 Dec 2016 22:43:05 +0000
User-agent: Posteo Webmail

hi

last time i mentioned it was a few years ago, and i just thought i let you know that sph-sc got some interesting updates recently, and plcss and sescript (as well as sph-lib) are still actively maintained.

"sc", for those who have not heard of it, is c written with s-expressions. it looks a lot like scheme, but it is actually mostly a 1:1 translation, like from (+ 1 2) to 1 + 2. it does not add new fundamental semantics or extra c code of its own. i still think it is fun to write in because it abstracts all of the various syntactic patterns that c has. for example it is now easy to use arbitrarily complex function pointers with "(function-pointer return-type types ...)" in place of type identifiers. for example, a variable declaration looks like this: "(define b int)". a function pointer variable declaration can look like this: "(define b (function-pointer (function-pointer char int) double))" - a pointer to a function returning a function. granted, the corresponding c code is shorter: "char(*(*b)(double))(int);" but the sc syntax is consistent, not "inside out" like the c syntax, and uses english words to tell about what it is

"sescript" is very similar to sc, it is like sc but for javascript or ecmascript. javascript on its own already feels more like scheme than c because of its use of anonymous first-class functions. sescript adds features like "let", implicit return and even an r6rs library form. sometimes i was able to copy code between scheme and sescript without change because it is so similar.

"plcss" creates css. it is written in less than 90 lines of scheme (but imports a few bindings) and can offer most features of or more than tools like sass and lesscss.

for details and examples, here links to the project homepages:
sc: http://sph.mn/content/3d3
sescript: http://sph.mn/content/413
plcss: http://sph.mn/content/e93

while we are at it, i recently made a time and calendar calculation library from scratch (which was pretty difficult, if anyone wants to check out how this can be done, see the "time" libraries in sph-lib (http://files.sph.mn/sourcecode/sph-lib/)) and this went into the calendar on http://ytilitu.xyz/ , which runs on guile.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]