LLOC (Logical Lines of Code) counts statements as the language’s grammar defines them. Where PLOC counts physical instruction lines, LLOC counts logical units of work — independent of how those units happen to be wrapped across physical lines.Documentation Index
Fetch the complete documentation index at: https://mehen.ophi.dev/llms.txt
Use this file to discover all available pages before exploring further.
What mehen emits
| Key | Type | Description |
|---|---|---|
loc.lloc | int | Logical lines (statements). |
How it is computed
The exact rule is language-specific because what counts as a statement depends on the grammar. Each analyzer crate implements LLOC by walking the parse tree and counting nodes that match its language’s statement kinds —expression_statement, declaration_statement, if_statement, for_statement,
return_statement, etc.
Worked example
factorial. PLOC for the same
file is 3 (the function signature line, the body line, and the closing brace), and SLOC is the full file
length.
The split between PLOC and LLOC is sharper in languages where one statement spans many lines (e.g., a
chained call in JavaScript or a multi-line tuple in Python).
When it is useful
- Comparing language idioms: a Python list comprehension might be 1 LLOC where the equivalent loop is 5 PLOC. LLOC normalizes for that.
- Detecting “hidden” complexity: when LLOC is much larger than PLOC suggests, the file is statement-dense.
References
- Park, R. E. (1992). Software Size Measurement: A Framework for Counting Source Statements. CMU/SEI-92-TR-20 — defines logical-statement counting and the difference between physical and logical lines. SEI report.
- Halstead, M. H. (1977). Elements of Software Science. Elsevier — early discussion of statement-level counting.
See also
- LOC family — overview.
- PLOC — physical instruction lines.
- SLOC — total physical lines.