53 Commits

Author SHA1 Message Date
a9b00f2135 use true bool, since we target c99 onwards 2026-09-27 18:06:59 +03:00
bf83baa508 read-time feature expressions
'#+' and '#-' introduce conditional compilation: the form that follows
is kept only when the feature expression is true, and otherwise is read
and thrown away.  An expression is a feature name, or and / or / not
of them.

They are read time, not compile time.

Default features are the host's software-version, software-type and
machine-type as CHICKEN reports them, plus what --features flag adds.
2026-09-16 17:59:37 +03:00
294a275905 fail when the C compiler fails, and clean up when we do
compile-to-file returned process-wait's values and main dropped them,
so cc errors were printed, but then main compiler exited 0.

Also cleanup tmp C files when compilation failed.
2026-09-16 17:34:24 +03:00
85bf1c163c generate temp .c files instead of passing to compiler's stdin
All checks were successful
Sex CI / build-linux (pull_request) Successful in 4m44s
For a clearer architecture
2026-09-15 21:28:41 +03:00
af6e778185 pass all args after '--' to C compiler verbatim 2026-09-15 16:32:55 +03:00
d83ee32f12 add source line number preservation
Some checks failed
Sex CI / build-macos (pull_request) Has been cancelled
Sex CI / build-linux (pull_request) Failing after 3m34s
For source-level debug. Add --line-directives option, defaulted to
statement. Disabled when used with -C. Explicit non-none value
overrides disabling when -C is present
2026-09-09 14:16:32 +03:00
528f26b7ef migrate to Chicken 6 2026-09-09 12:45:12 +03:00
c678df7978 add sextest test runner
A tool for testing Sex programs. Details in tools/sextest/README.org
2026-05-21 20:15:03 +03:00
196694f18e modularize sex
Also rename macros to sex-macros, module-system to sex-modules for
clarity, uniformity, and to avoid name clashes with Chicken's
units/modules named "macros" and "modules"
2026-04-29 22:48:55 +03:00
f5b3fcb399 add #line directive to generated C code to support source debugging 2025-12-01 15:42:06 +03:00
55a0235a37 add initial prelude 2025-10-30 18:05:44 +03:00
462916b7a9 don't force c89 after all 2025-09-30 09:35:16 +03:00
072d3a64aa update Readme.org 2025-09-30 09:35:16 +03:00
b1744bb6af split semantic processing and fmt-c code generation
Introducing Sex SEMantic ENgine: the semen.
Also split reader to other file (it can be replaced in the future).
Macro expansion inside Sex code doesn't work yet, and it must be done
in semen, not during fmt-c generation as before.
2025-09-29 15:50:01 +03:00
8e4cc98522 fix sexc using non-existent unit 2025-09-01 11:24:08 +03:00
53e9614584 don't create temp files when compiling 2025-08-22 15:47:36 +03:00
d5e443a72c force c89 pedantic compilation mode 2025-08-22 15:47:36 +03:00
78977e988e add support for begin in Sex
begin-wrapped blocks are now creating lexical scopes
2025-08-22 15:47:36 +03:00
ea13df186f add structure attributes support to sex 2025-08-06 15:38:04 +03:00
6c6e00e6dc implement new macro system 2025-08-06 15:38:04 +03:00
31d0aa574b saner getting of c compiler args from the cmdline 2025-08-05 02:03:01 +03:00
41c3f3bd98 make fmt-c a unit 2025-08-03 21:44:43 +03:00
3ad25b3788 make return explicit
Required pulling in fmt-c.scm file though :(
2025-08-03 19:01:19 +03:00
d4e1471f44 remove unused function 2025-08-02 10:49:38 +03:00
bc54ae6a05 modularize Sex compiler 2025-08-02 10:49:38 +03:00
4be0d3f5ac prettify --help output and add it to Readme.org 2025-08-02 10:49:38 +03:00
44a352849a implement modules 2025-08-02 10:49:38 +03:00
6fc1688e41 call C compiler from Sex directly
Also rework options printing, add some cmdline options, rework others,
all in all, the logic is now looking like this:
* -E to emit C code
* -m to emit macro-expanded Sex code
* -c to emit object file instead of executable
* --c-compiler to set C compiler. If not provided, check SEX_CC
enviroment variable, if it's empty, default to `cc'
* options after -- are passed to C compiler
* default mode is to compile Sex module to executable
2025-08-02 10:49:38 +03:00
7967a75313 remove some stray variable 2025-08-02 10:49:38 +03:00
76ca609ea6 Make Sex templates more pleasant syntactically
No more unquotes to instantiate templates.
Also no need to pass quoted substitution lists, just use them as
regular lisp macros.
2025-07-11 18:27:50 +03:00
12ff37c515 support unkebabification in #()-forms
which are vectors in Chicken, {}-initializers in C
2025-06-14 19:02:45 +03:00
075116dfd2 support cpp define 2025-06-14 18:10:20 +03:00
e932afab0a prefix define and define-syntax with chicken-
as we have define in cpp
2025-06-14 18:09:50 +03:00
97205ed8ef don't unkebabify -> in symbols (it's -> from C) 2025-06-14 17:48:41 +03:00
650bff6d0e fix pub function prototypes 2025-06-14 17:10:09 +03:00
5f919c387d change load to chicken-load in sex sources
to explicitly denote that it is chiken
2025-06-14 14:09:39 +03:00
bd71dcc8a7 add chicken-import support to sex
also fix unquoting to single atom processing wrongly in walk-sex-tree
2025-06-14 14:07:00 +03:00
6e59e523d4 hanlde pub for global vars correctly 2025-06-14 12:39:13 +03:00
16dec0728f add extern support 2025-06-13 18:20:51 +03:00
3cce26dc5c add field access support (also unfuck tree walker a bit) 2025-06-12 23:40:35 +03:00
19cc3ad43a unshittify templates 2025-06-11 20:23:54 +03:00
241d605db4 implement templates (kinda)
uh oh
2025-06-09 00:30:14 +03:00
408c0c1441 make some exceptions for unkebabification 2025-06-09 00:29:31 +03:00
5220e0eafd [] isn't gonna work with Sheme reader 2025-06-09 00:27:36 +03:00
839a6cb350 don't need map here, for-each is enough 2025-06-09 00:27:21 +03:00
0d72b1950d fix reading from files not in current dir 2025-06-09 00:27:03 +03:00
469db7b92e add auto typedefs for structs 2025-06-09 00:21:42 +03:00
39e1e4a664 rewrite tree walk with tree module
also add pub support
2025-06-05 17:11:30 +03:00
dd9765bd62 filter out '()s from the tree 2025-06-05 12:15:06 +03:00
46877241d9 add cmdline options
-h help
-o write to file
-m expand macros in Sex code and print result
2025-06-05 07:32:05 +03:00