aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/generated.c6
-rw-r--r--examples/translator.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/examples/generated.c b/examples/generated.c
new file mode 100644
index 0000000..0b70fd6
--- /dev/null
+++ b/examples/generated.c
@@ -0,0 +1,6 @@
+#include <csx.h>
+int main()
+{
+csx_eval(csx_list(csx_name("do"),csx_list(csx_name("define"),csx_name("a"),csx_num(10),0),csx_list(csx_name("define"),csx_name("b"),csx_list(csx_name("sum"),csx_name("a"),csx_num(3),0),0),csx_list(csx_name("outname"),csx_list(csx_name("quote"),csx_name("sum-of-10-and-3-is"),0),0),csx_list(csx_name("outnum"),csx_name("b"),0),0));
+return 0;
+}
diff --git a/examples/translator.c b/examples/translator.c
index 448d052..ad676c0 100644
--- a/examples/translator.c
+++ b/examples/translator.c
@@ -14,7 +14,7 @@ void readlist()
readlist();
printf("0)");
c = getchar();
- } else if (isdigit(c)) {
+ } else if (isdigit(c) || c == '-') {
if (first) first = 0;
else putchar(',');
printf("csx_num(");