seq_runtime/
lib.rs

1//! Seq Runtime: A clean concatenative language foundation
2//!
3//! Key design principles:
4//! - Value: What the language talks about (Int, Bool, Variant, etc.)
5//! - StackNode: Implementation detail (contains Value + next pointer)
6//! - Variant fields: Stored in arrays, NOT linked via next pointers
7
8pub mod arena;
9pub mod args;
10pub mod arithmetic;
11pub mod channel;
12pub mod closures;
13pub mod cond;
14pub mod file;
15pub mod float_ops;
16pub mod io;
17pub mod list_ops;
18pub mod map_ops;
19pub mod pool;
20pub mod quotations;
21pub mod scheduler;
22pub mod seqstring;
23pub mod serialize;
24pub mod stack;
25pub mod string_ops;
26pub mod tcp;
27pub mod tcp_test;
28pub mod value;
29pub mod variant_ops;
30
31// Re-export key types and functions
32pub use stack::{
33    Stack, StackNode, drop, is_empty, patch_seq_drop_op as drop_op, patch_seq_dup as dup,
34    patch_seq_nip as nip, patch_seq_over as over, patch_seq_pick_op as pick_op,
35    patch_seq_push_value as push_value, patch_seq_rot as rot, patch_seq_swap as swap,
36    patch_seq_tuck as tuck, peek, pick, pop, push,
37};
38pub use value::{MapKey, Value, VariantData};
39
40// Serialization types (for persistence/exchange with external systems)
41pub use serialize::{SerializeError, TypedMapKey, TypedValue, ValueSerialize};
42
43// Arithmetic operations (exported for LLVM linking)
44pub use arithmetic::{
45    patch_seq_add as add, patch_seq_divide as divide, patch_seq_eq as eq, patch_seq_gt as gt,
46    patch_seq_gte as gte, patch_seq_lt as lt, patch_seq_lte as lte, patch_seq_multiply as multiply,
47    patch_seq_neq as neq, patch_seq_push_bool as push_bool, patch_seq_push_int as push_int,
48    patch_seq_subtract as subtract,
49};
50
51// Float operations (exported for LLVM linking)
52pub use float_ops::{
53    patch_seq_f_add as f_add, patch_seq_f_divide as f_divide, patch_seq_f_eq as f_eq,
54    patch_seq_f_gt as f_gt, patch_seq_f_gte as f_gte, patch_seq_f_lt as f_lt,
55    patch_seq_f_lte as f_lte, patch_seq_f_multiply as f_multiply, patch_seq_f_neq as f_neq,
56    patch_seq_f_subtract as f_subtract, patch_seq_float_to_int as float_to_int,
57    patch_seq_float_to_string as float_to_string, patch_seq_int_to_float as int_to_float,
58    patch_seq_push_float as push_float,
59};
60
61// I/O operations (exported for LLVM linking)
62pub use io::{
63    patch_seq_exit_op as exit_op, patch_seq_push_string as push_string,
64    patch_seq_read_line as read_line, patch_seq_read_line_plus as read_line_plus,
65    patch_seq_write_line as write_line,
66};
67
68// Scheduler operations (exported for LLVM linking)
69pub use scheduler::{
70    patch_seq_scheduler_init as scheduler_init, patch_seq_scheduler_run as scheduler_run,
71    patch_seq_scheduler_shutdown as scheduler_shutdown, patch_seq_spawn_strand as spawn_strand,
72    patch_seq_strand_spawn as strand_spawn, patch_seq_wait_all_strands as wait_all_strands,
73    patch_seq_yield_strand as yield_strand,
74};
75
76// Channel operations (exported for LLVM linking)
77pub use channel::{
78    patch_seq_chan_receive as receive, patch_seq_chan_receive_safe as receive_safe,
79    patch_seq_chan_send as send, patch_seq_chan_send_safe as send_safe,
80    patch_seq_close_channel as close_channel, patch_seq_make_channel as make_channel,
81};
82
83// String operations (exported for LLVM linking)
84pub use io::patch_seq_int_to_string as int_to_string;
85pub use string_ops::{
86    patch_seq_json_escape as json_escape, patch_seq_string_chomp as string_chomp,
87    patch_seq_string_concat as string_concat, patch_seq_string_contains as string_contains,
88    patch_seq_string_empty as string_empty, patch_seq_string_length as string_length,
89    patch_seq_string_split as string_split, patch_seq_string_starts_with as string_starts_with,
90    patch_seq_string_to_int as string_to_int, patch_seq_string_to_lower as string_to_lower,
91    patch_seq_string_to_upper as string_to_upper, patch_seq_string_trim as string_trim,
92};
93
94// Quotation operations (exported for LLVM linking)
95pub use quotations::{
96    patch_seq_call as call, patch_seq_peek_is_quotation as peek_is_quotation,
97    patch_seq_peek_quotation_fn_ptr as peek_quotation_fn_ptr,
98    patch_seq_push_quotation as push_quotation, patch_seq_spawn as spawn, patch_seq_times as times,
99    patch_seq_until_loop as until_loop, patch_seq_while_loop as while_loop,
100};
101
102// Closure operations (exported for LLVM linking)
103pub use closures::{
104    patch_seq_create_env as create_env, patch_seq_env_get as env_get,
105    patch_seq_env_get_int as env_get_int, patch_seq_env_set as env_set,
106    patch_seq_make_closure as make_closure, patch_seq_push_closure as push_closure,
107};
108
109// Conditional combinator (exported for LLVM linking)
110pub use cond::patch_seq_cond as cond;
111
112// TCP operations (exported for LLVM linking)
113pub use tcp::{
114    patch_seq_tcp_accept as tcp_accept, patch_seq_tcp_close as tcp_close,
115    patch_seq_tcp_listen as tcp_listen, patch_seq_tcp_read as tcp_read,
116    patch_seq_tcp_write as tcp_write,
117};
118
119// Variant operations (exported for LLVM linking)
120pub use variant_ops::{
121    patch_seq_make_variant_0 as make_variant_0, patch_seq_make_variant_1 as make_variant_1,
122    patch_seq_make_variant_2 as make_variant_2, patch_seq_make_variant_3 as make_variant_3,
123    patch_seq_make_variant_4 as make_variant_4, patch_seq_unpack_variant as unpack_variant,
124    patch_seq_variant_field_at as variant_field_at,
125    patch_seq_variant_field_count as variant_field_count, patch_seq_variant_tag as variant_tag,
126};
127
128// Command-line argument operations (exported for LLVM linking)
129pub use args::{
130    patch_seq_arg_at as arg_at, patch_seq_arg_count as arg_count, patch_seq_args_init as args_init,
131};
132
133// File operations (exported for LLVM linking)
134pub use file::{
135    patch_seq_file_exists as file_exists,
136    patch_seq_file_for_each_line_plus as file_for_each_line_plus,
137    patch_seq_file_slurp as file_slurp, patch_seq_file_slurp_safe as file_slurp_safe,
138};
139
140// List operations (exported for LLVM linking)
141pub use list_ops::{
142    patch_seq_list_each as list_each, patch_seq_list_empty as list_empty,
143    patch_seq_list_filter as list_filter, patch_seq_list_fold as list_fold,
144    patch_seq_list_length as list_length, patch_seq_list_map as list_map,
145};
146
147// Map operations (exported for LLVM linking)
148pub use map_ops::{
149    patch_seq_make_map as make_map, patch_seq_map_empty as map_empty, patch_seq_map_get as map_get,
150    patch_seq_map_get_safe as map_get_safe, patch_seq_map_has as map_has,
151    patch_seq_map_keys as map_keys, patch_seq_map_remove as map_remove,
152    patch_seq_map_set as map_set, patch_seq_map_size as map_size,
153    patch_seq_map_values as map_values,
154};