Repository navigation
v0.2.2-alpha
·
114 commits
to main
since this release
Added
- Phase 6: string & formatting rework (spec §3/§18.1, v2.2). Python-style f-strings land:
f"..."/f'...'with{expr}interpolation,{:spec}format refinements (float precision, zero-padding, width/alignment),{{/}}escapes, and rawrf"..."/rf'...'combined form. New literals: single-quoted strings'...'(escape-equivalent to"..."; a single character remains aCharper the spec BNF) and raw stringsr"..."/r'...'(no escape processing). The lexer tracks{{/}}and brace/string nesting inside interpolations and rejects nested f-string literals as a compile-time error. Interpolations are rendered with the activeprint_format(default LaTeX). - Doc comments (
//////!) enter the AST (spec §4.1, v2.2). Doc comments are now language semantics: the lexer emits them, the parser collects consecutive lines intoProgram.module_docs/Import.docs/Stmt.*.docs/ClassMember.docs, andprima fmtre-emits them. A//////!with no following item warnsW0007 unattached_doc_comment(spec §16.5;//!anywhere but the file top shares the code). - Method-call diagnostic notes (spec §16.4, v2.2). When a method call fails — unknown method, wrong arity, visibility violation, or a runtime error thrown inside the method body — the diagnostic attaches a note with the method's signature, definition location, and
///doc, plus adid you meansuggestion for typos (String.toupper()→to_upper).prima checkattaches the same definition note to stdlib@builtincall-site errors (E0050). prima docMarkdown output (spec §20). Renders#module title,//!module doc, and one##section per definition with its///doc and signature;-o FILEwrites to a file and--stdlibdocuments every embedded stdlib module, giving offline method docs (spec §16.4).- Stdlib & native-class doc comments (spec §4.1/§18.1/§18.4). Every embedded stdlib signature module (
linalg,stats,io,num,plot,sys::path,sys::env,sys::os,time) carries a//!module doc and a///doc per@builtinfunction, and a new embeddedcore::stringmodule documents the nativeStringclass and its method set. At startupprima-stdlibparsesstring.praand seeds the runtime doc registry (Stringclass-level doc plus oneString::<method>entry per member) with rendered signatures,///doc text, andcore/string.pra:<line>:<col>definition locations, so diagnostics attach a method signature + doc note to failed calls (spec §16.4).
Changed
formatremoved (spec §18.1). It is no longer a pre-imported builtin; a call to a bareformat(...)emits the transition warningW0006(visible inprima checkand evaluator warnings;--deny W0006promotes it to an error) and then fails as an unknown function. Module functions such astime::formatare unaffected. All examples/tests were migrated to f-strings (examples/fstring.prais the new reference;examples/try_catch.pranow uses f-strings).Literal::Strrenamed toLiteral::String { value, quote, raw }(AST records the delimiter and raw-ness);prima fmtre-emits strings/f-strings losslessly and idempotently.