Commit Graph

215 Commits

Author SHA1 Message Date
d890080103 find the conditional by tokens a path cannot hold
"holds no directive" searched for 123, a digit run the temporary
directory in every #line could hold too.
2026-10-27 23:38:04 +03:00
a2bbb73524 spell the least long long as C's LLONG_MIN
-9223372036854775808 reached C as written, where it negates an unsigned
constant, and had no type for inference: it is read as
-9223372036854775807 - 1, which is long long on both sides.
2026-10-27 23:38:04 +03:00
28aaaf637c refuse a closure capturing one name twice
check-capture-names held captures against the parameters and the body,
not against each other: (n n) gave C two members and two parameters n.
2026-10-27 23:38:04 +03:00
acbd4928f5 read a member path and a receiver through a pointer chain
All checks were successful
Sex CI / build-linux (pull_request) Successful in 5m34s
A pointer to a pointer has no fields, so (. pp x) has one meaning, and
it came out pp->x; it is (*pp)->x, and a method receiver alike.
2026-10-27 01:31:37 +03:00
7973a4331d split the C compiler's name from its options
SEX_CC="ccache cc" went looking for an executable of that whole name;
it is read as make reads CC now.
2026-10-27 01:31:37 +03:00
a53c358113 type a value if as the join of its branches
It had no rule, so _ could not be set from one.
2026-10-27 01:31:37 +03:00
8c92c245c5 read a quoted name as the name
'-fields read as (- fields), so (cat name '-fields) built name(- fields).
A quoted list keeps the rule: it is code a macro returns as often as not.
2026-10-27 01:31:37 +03:00
af8e49cdd3 refuse a macro defined after a call to it
The call was compiled as a function's, and the macro went unused there
without a word.
2026-10-27 01:31:37 +03:00
9505b4f0a0 refuse an integer with a leading 0
017 is 17 to Scheme and 15 to C, so whoever reads the Sex and whoever
reads the C would each take it for something else.
2026-10-27 01:31:37 +03:00
8d6d1855e2 refuse a variant named like a C keyword
One with fields is a member of the sum's union, and C takes no member
named int; one without is held to the same, as one rule.
2026-10-27 01:31:37 +03:00
f66eaa7454 match a sum through a pointer to it
A pointer was refused, where . reads through one; a match now reads
through the whole chain of them to the sum.
2026-10-27 01:31:37 +03:00
2fa1ed21d7 take a docstring on a sum
record, struct and enum take one; sum read it where its variants go.
2026-10-27 01:31:37 +03:00
1dd1cf0ae9 expand a module's toplevel macro calls for its importers
Its interface was read as written, so pub forms a macro wrote never
reached them, which list-macros' is-public? flag exists for. The
module's macros, and those its imports give it, are lent for the
reading and taken back after. One reading a type the module keeps to
itself cannot expand there, and gives importers nothing, as before.
2026-10-27 01:31:37 +03:00
7c897b6dc6 refuse a pub realization of a spec importers cannot see
It failed in whichever importer named the module before the spec's,
pointing at the module, where a hidden type is refused in the module
already: so is this, the remedy the same.
2026-10-27 01:31:37 +03:00
b285174a22 count a unit among its own imports
Two modules importing each other with pub hand the unit its own
interface back, and its types were defined twice.
2026-10-27 01:31:37 +03:00
4bdc0e57a7 type #t, an enum's constants and the bitwise names
None had a rule. A constant is typed as its enum, where C says int, so
that the enum's ops are found through it. And bit-and, bit-not and the
rest were respelled bit_and before fmt-c could see them, and called.
2026-10-27 01:31:37 +03:00
2024d4d0f4 type a call by the type of what it calls
Only a function's name was asked what it returns, so a call through a
local or a field holding a pointer had no type, a local named like a
function took the function's, and a closure's call helper, which
nothing registered, left _ nothing to read.
2026-10-27 01:31:37 +03:00
1bdeda6cc3 name a lambda's unnamed parameters in its definition
A definition names every parameter before C23, as a closure's code
already does.
2026-10-27 01:31:37 +03:00
6ad8f8f56b keep the writer's own words to the head of a form
They were its own wherever they stood, so a name spelled like one --
(var array int), a parameter `define' -- came out %array, %define.
2026-10-27 01:31:37 +03:00
fb26b92fdc print an error as its message alone
Every error ended in CHICKEN's call history, which is for working on
sexc itself, and is now asked for by SEXC_DEBUG; a missing input file
says so, rather than as an open-input-file error of CHICKEN's.
2026-10-27 01:31:37 +03:00
7649e47297 refuse an output naming the source
-o naming the input wrote over it, whatever was asked for.
2026-10-27 01:31:37 +03:00
389e73323f refuse a second input file
It was never read, and nothing said so.
2026-10-27 01:31:37 +03:00
83282adfb9 leave none of an output a failure stopped writing
A failed -C -o left the file truncated, which make would take for done.
2026-10-27 01:31:37 +03:00
5afe32a888 read a lone - as stdin
getopt-long read it as an option it did not know, and died.
2026-10-27 01:31:37 +03:00
8220c500df refuse a malformed closure capture
((+ a 1)) was a capture named `+' holding a.
2026-10-27 01:31:37 +03:00
dd5174f472 refuse a statement of the wrong shape
(goto), (var q), (cast i), (while) and the like died in the writer, in
CHICKEN's words about a procedure of its own and with no location;
(return 1 2), (break 1) and (sizeof a b) dropped what was extra.
2026-10-27 01:31:37 +03:00
8e3e6fcdd1 say which macro call an error came from
A wrong argument count was CHICKEN's to report, about a procedure with
no name, and an error raised in a macro's body said nothing of the call.
2026-10-27 01:31:37 +03:00
4fa8a021de say where a reader error was met
Every later stage's error says file:line, and the reader's said only
what; an unclosed list, met at the end of the file, now names the line
it opened on as well.
2026-10-27 01:31:37 +03:00
e0ecde6517 refuse _ in a function's signature
Nothing solves it there, and it reached the C as _.
2026-10-27 01:31:37 +03:00
0a0a3f6b25 decay an array into a wildcard standing alone
An array as a value is a pointer to its first element; _ took the array
type, and declared a copy that C cannot initialize from it.
2026-10-27 01:31:37 +03:00
3436c4ff3e read an array's length as types does
Inference took only an integer for a length, and read a name there as
part of the element type: [_ N] did not solve, and an array of [int N]
decayed to int N *.
2026-10-27 01:31:37 +03:00
cb37821e3e let a realization's methods call one another
Each was registered as its body was walked, so a method could not call
one coming after it -- a default included, defaults coming after the
written ones. All are registered first now, as an ops block's are.
2026-10-27 01:31:37 +03:00
94f41b5fad define an empty lambda as an empty function
A lifted function with no body was a declaration of one, and nothing
defined it, so the program did not link.
2026-10-27 01:31:37 +03:00
b3d7decc6b take an unnamed closure parameter, and refuse a variadic one
The closure's type was built from each parameter's second element, so
a type alone, or the ..., crashed sexc. A variadic closure cannot work:
its call helper would have to forward what C cannot.
2026-10-27 01:31:37 +03:00
d9bc8967ba refuse a capture a parameter or the body names too
Captures are a closure's other parameters, and C's redefinition error
was the first anyone heard of one sharing a name with a parameter, or
being redeclared at the top of the body.
2026-10-27 01:31:37 +03:00
3d295f4cd0 capture an array and a const local
C copies an array neither by = nor from another array's initializer,
and a const field cannot be assigned: both failed in the C. An array is
copied in element by element; a const one is held as its value.
2026-10-27 01:31:37 +03:00
20311a200d resolve the closure types in a closure's signature
The struct, call helper and conversion thunk of a closure type went out
with any closure type in its signature as written, which C has no name
for; so a closure could neither return nor take one, and no currying.
2026-10-27 01:31:37 +03:00
10de092ab0 designate an initializer's element by its index
[3] in braces reached the writer as a subscript of one operand, and
sexc died taking the second.
2026-10-27 01:31:37 +03:00
befe2ca25b nest a function type's declarator round the name
A function type's return was written ahead of its declarator, so one
returning a function pointer came out int (*)(int) get (void), and a
variable of such a type as void (*)() (*g)(int).
2026-10-27 01:31:37 +03:00
8cb141de5d leave an empty for slot empty
() went to C as NULL, so (for () () ()) tested false and never ran; it
is for (;;).
2026-10-27 01:31:37 +03:00
c0ed7ad916 write an empty block as {}
(do), and a for with no body, gave c-begin nothing to begin with, and
the writer died on its arity.
2026-10-27 01:31:37 +03:00
ffa5e9b02c write #() as {0}
{} is C23's. #() is all zeros, which C11 spells {0}, whatever it
initializes.
2026-10-27 01:31:37 +03:00
06bbe4b97d refuse a malformed enumerator
Anything in the list but a name or (name value) was taken apart as if
it were the pair: (! 1 2) came out ! = 1.
2026-10-27 01:31:37 +03:00
1b59848b42 keep an aggregate written in place behind a pointer
A type was flattened word by word, a struct's body included, so
(* (struct ((c int)))) came out struct c{ int; } *.
2026-10-27 01:31:37 +03:00
32515c0eb8 keep an array literal a global pointer is set to
At file scope every compound literal was cut down to its braces, right
for a value and not for an array a pointer points at: the address of a
static object is a constant, and its braces alone the pointer's own.
2026-10-27 01:31:37 +03:00
42c76d07e6 see a pointer through a typedef of one
Only a written (* T) was a pointer, so with (typedef pt-ref (* pt)) a
path read q as a value and a method found no type to dispatch on.
2026-10-27 01:31:37 +03:00
04c3267bfe type an indexed step of a member path
(. q [pts 2] y) looked the step up as a field whole, so its type was
lost: the next step guessed a value, and through an array of pointers
wrote . for ->.
2026-10-27 01:31:37 +03:00
c8a39b7e62 write a #line file name as a C string literal
It was pasted between quotes as it came, so a quote in the path ended
it, a backslash began an escape, and ?? read as a trigraph.
2026-10-27 01:31:37 +03:00
6e4ad81538 splice a $ nested in a macro's $
Only the outermost was taken apart, so ($ a ($ b c)) left the inner
one an unknown toplevel form, and in a body a call of $ in the C.
2026-10-27 01:31:37 +03:00
192ed2ba64 refuse a char literal that is not one byte
A char is C's, and #\λ came out a multi-character constant whose value
is the C compiler's to choose.
2026-10-27 01:31:37 +03:00