From caa88a9b36d9e1dfae40ecb31aee05bc2891fa17 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 27 Oct 2026 14:07:24 +0000 Subject: docs(preprocessor): document switches and library regions Add manuals and aliases for all five PP directives, replace the retired #LIB page, and update compiler and shared-editor architecture notes. Co-Authored-By: Claude Opus 5.5 --- doc/cpsc.1.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/cpsc.1.md') diff --git a/doc/cpsc.1.md b/doc/cpsc.1.md index e0e92e0..d5a8d72 100644 --- a/doc/cpsc.1.md +++ b/doc/cpsc.1.md @@ -16,6 +16,8 @@ Compile one or more pseudocode source files to a native executable, or to textua Without **-o**, save beside the entry source file, replacing its extension with `.exe` on Windows or `.out` elsewhere for an executable, or `.ll` for IR. With **-r** alone, run without saving a file. +Each input is independently preprocessed using file-local PP_DEFINE/PP_UNDEF switches and PP_IFDEF/PP_IFNDEF/PP_ENDIF conditions. PP_DEFINE __LIB enables library runtime line reporting for subsequent source positions; PP_UNDEF __LIB restores ordinary behavior. See [cpsc-keyword-pp_define(7)](language/keyword/cpsc-keyword-pp_define.7.md). + Each input is a compilation unit. Use top-level `INCLUDE "lib.cps"` to import another input's exported definitions, including its transitive imports. Paths are relative to the including source; every included file must also appear on the command line. Repeated includes and include cycles are harmless. Giving the same input twice, including symbolic or hard links, is an error. Duplicate definitions across files are errors even if the files do not include each other; distinct signatures, differing in parameters or return type, may share a name when every definition specifies OVERLOAD. Exactly one file may contain top-level executable statements (including top-level DECLARE). Alternatively, define a parameterless `FUNCTION MAIN RETURNS INTEGER` in one file and have no top-level executable statements anywhere. Builds containing only definitions and no MAIN fail with `error: no main program`. GLOBAL blocks declare shared primitive variables. INCLUDE, GLOBAL and MAIN entry points are compiler extensions beyond the Cambridge guide. -- cgit v1.3.1-4-g156e