How quark-programming/quark works
Quark is an early-stage programming language compiler that translates Quark source into C. The principal workflow is command-line input, tokenization, parsing into syntax nodes, and compilation to an output file; parsing covers expressions, declarations, statements, literals, and types. The compiler dispatches syntax nodes to code-generation handlers. The README establishes the compiler’s purpose, while edges are limited to relationships shown in the supplied excerpts or SOURCE INDEX; several parser and compiler internals were not sampled.
Main entry points: main.c CLI and orchestration · compiler.c Compiler dispatch · righthand.c Right expressions · keywords.c Statement keywords
Components 20
Source processing
- Tokenizer
src/tokenizer/tokenizer.c
Parsing and types
- Parser state
src/parser/parser.c - Syntax nodes
src/parser/nodes/nodes.c - Statements and scopes
src/parser/statement/statement.c - Statement keywords
src/parser/statement/keywords.c - Left expressions
src/parser/lefthand/lefthand.c - Right expressions
src/parser/righthand/righthand.c - Field and index access
src/parser/righthand/field_access.c - Declarations
src/parser/righthand/declaration/declaration.c - Literal parsing
src/parser/literal/array.c - Type operations
src/parser/type/types.c - Generic types
src/parser/type/generics.c
C generation
- Compiler dispatch
src/compiler/compiler.c - Literal codegen
src/compiler/literal/literals.c - Expression codegen
src/compiler/righthand/righthand.c - Declaration codegen
src/compiler/righthand/declaration/variable_declaration.c - Statement codegen
src/compiler/statement/statement.c
Other components
- Compiler user
- CLI and orchestration
src/main.c - Generated C file
Connections 23
- Compiler user → CLI and orchestration: provides source
src/main.c - CLI and orchestration → Tokenizer: creates tokenizer
src/main.c - CLI and orchestration → Parser state: initializes parser
src/main.c - CLI and orchestration → Statements and scopes: collects statements
src/main.c - CLI and orchestration → Compiler dispatch: compiles entry
src/main.c - CLI and orchestration → Generated C file: writes C
src/main.c - Parser state → Syntax nodes: uses node types
- Left expressions → Right expressions: parses continuation
src/parser/lefthand/lefthand.c - Left expressions → Literal parsing: parses literals
src/parser/lefthand/lefthand.c - Left expressions → Statements and scopes: uses scopes
src/parser/lefthand/lefthand.c - Right expressions → Field and index access: dispatches access
- Field and index access → Declarations: resolves members
src/parser/righthand/field_access.c - Field and index access → Type operations: opens types
src/parser/righthand/field_access.c - Statement keywords → Statements and scopes: uses scopes
src/parser/statement/keywords.c - Statement keywords → Right expressions: parses expressions
src/parser/statement/keywords.c - Statement keywords → Type operations: checks types
src/parser/statement/keywords.c - Generic types → Type operations: clashes types
src/parser/type/generics.c - Generic types → Right expressions: parses arguments
src/parser/type/generics.c - Generic types → Declarations: applies arguments
src/parser/type/generics.c - Compiler dispatch → Literal codegen: dispatches literals
src/compiler/compiler.c - Compiler dispatch → Expression codegen: dispatches expressions
src/compiler/compiler.c - Compiler dispatch → Declaration codegen: dispatches declarations
src/compiler/compiler.c - Compiler dispatch → Statement codegen: dispatches statements
src/compiler/compiler.c