Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/4RH1T3CT0R7/ttf-doom
/ functions
Functions
584 in github.com/4RH1T3CT0R7/ttf-doom
⨍
Functions
584
◇
Types & classes
112
↓ 72 callers
Function
to_fixed
Convert a Python float to 16.16 fixed-point integer. Args: value: Real number to convert. Returns: Signed 32-bit integer in
compiler/stdlib.py:39
↓ 55 callers
Method
_expect
Consume a token of type *tt* or raise :class:`ParseError`.
compiler/parser.py:162
↓ 53 callers
Function
_compile
Compile a DSL source string to assembly segments.
tests/test_codegen.py:64
↓ 36 callers
Function
_first_decl
Return the first top-level declaration.
tests/test_parser.py:37
↓ 31 callers
Function
compile_doom
Compile a .doom DSL source string into a .ttf font file. Runs the full compilation pipeline: 1. Parse source text into an AST. 2.
compiler/pipeline.py:175
↓ 31 callers
Function
generate_sin_cos_tables
Generate fixed-point sin/cos lookup tables. Divides a full circle into *entries* equal steps and computes ``sin(angle) * scale`` and ``cos(an
fontgen/math_tables.py:17
↓ 28 callers
Function
rect
(x, y, rw, rh, color)
hosts/browser/doom.js:467
↓ 28 callers
Function
rect
(x, y, rw, rh, color)
docs/doom.js:467
↓ 27 callers
Method
_push_value
Generate a PUSH instruction for an integer value. Args: value: The integer to push onto the TT stack. Returns:
compiler/codegen.py:717
↓ 22 callers
Method
_compile_expr
Compile an expression, leaving its result on the stack. Args: expr: An AST expression node. Returns: List of
compiler/codegen.py:242
↓ 18 callers
Method
tokenize
Return the complete list of tokens for the source text.
compiler/lexer.py:189
↓ 16 callers
Method
compile
Compile a ``Program`` AST to assembly. Args: program: The root AST node. Returns: Dict with keys ``'fpgm'``,
compiler/codegen.py:112
↓ 15 callers
Method
parse
Parse the complete source and return a :class:`Program` AST.
compiler/parser.py:126
↓ 14 callers
Method
_match
If the current token matches any of *types*, consume and return it.
compiler/parser.py:156
↓ 14 callers
Method
_peek
Return the current token without consuming it.
compiler/parser.py:142
↓ 14 callers
Function
simulate_fixmul
Simulate the fixmul FDEF through TT arithmetic. Mirrors the instruction sequence in ``_fixmul_asm()``: 1. ``MUL[]`` -> ``(a * b) / 64`
tests/test_stdlib.py:81
↓ 13 callers
Function
from_fixed
Convert a 16.16 fixed-point integer back to a Python float. Args: raw: Integer in 16.16 fixed-point representation. Returns:
compiler/stdlib.py:51
↓ 12 callers
Method
_expr
Top-level expression: or_expr.
compiler/parser.py:435
↓ 12 callers
Function
_types
Return just the token types for *source* (excluding EOF).
tests/test_lexer.py:14
↓ 12 callers
Function
build_bar_glyph
Create a glyph with *num_bars* vertical rectangular contours. Each bar is a separate closed contour occupying an equal horizontal slice of th
fontgen/glyph_builder.py:19
↓ 11 callers
Method
_advance
Consume and return the current token.
compiler/parser.py:146
↓ 11 callers
Method
alloc_func
Allocate a function ID for an FDEF. Args: name: Function name. Returns: Assigned FDEF function ID.
compiler/allocator.py:94
↓ 10 callers
Function
_parse
(src: str)
tests/test_parser.py:33
↓ 9 callers
Method
alloc_var
Allocate a single storage slot for a variable. Args: name: Variable name. Returns: Assigned storage slot ind
compiler/allocator.py:55
↓ 9 callers
Function
isWall
(wx, wy)
hosts/browser/doom.js:126
↓ 9 callers
Function
isWall
(wx, wy)
docs/doom.js:126
↓ 8 callers
Method
_check
Return True if the current token has the given type.
compiler/parser.py:152
↓ 8 callers
Function
_trunc_div
Integer division that truncates toward zero (C / TT semantics). Python's ``//`` floors toward negative infinity, but the TrueType VM truncate
tests/test_stdlib.py:35
↓ 8 callers
Function
build_doom_font
Build the complete DOOM ``.ttf`` font. Args: fpgm_asm: Assembly instructions for the font program (function definitions loade
fontgen/font_builder.py:34
↓ 8 callers
Function
simulate_fixdiv
Simulate the fixdiv FDEF through TT arithmetic. Mirrors the instruction sequence in ``_fixdiv_asm()``: 1. ``SWAP`` -
tests/test_stdlib.py:98
↓ 7 callers
Function
_push_and_store
Generate assembly to store *value* at *storage_idx*. Uses ``PUSHB`` for values in [0, 255] and ``PUSHW`` otherwise. The storage index is pus
fontgen/math_tables.py:77
↓ 7 callers
Method
alloc_func_locals
Allocate storage slots for function parameters. Parameters are stored in storage slots so they can be referenced by name inside the f
compiler/allocator.py:113
↓ 7 callers
Function
get_stdlib_functions
Return TT assembly bodies for every standard-library function. Each value is a list of TrueType assembly mnemonics that form the function bod
compiler/stdlib.py:67
↓ 6 callers
Method
_compile_func
Emit an FDEF block for a user-defined function.
compiler/codegen.py:180
↓ 6 callers
Function
_is_valid_instruction
Check whether a single assembly line is a valid TT instruction.
tests/test_codegen.py:92
↓ 6 callers
Function
build_notdef_glyph
Create a minimal ``.notdef`` glyph. The ``.notdef`` glyph is a required placeholder in every TrueType font. It is drawn as a simple rectangle
fontgen/glyph_builder.py:57
↓ 6 callers
Function
generate_prep_load_tables
Generate TrueType assembly to load sin/cos tables into storage. Emits a sequence of ``PUSHB``/``PUSHW`` + ``WS[]`` instructions that write ev
fontgen/math_tables.py:46
↓ 5 callers
Function
_is_valid_instruction
Check whether a single assembly line is a valid TT instruction. Recognises: - Bare mnemonics like ``MUL[]``, ``SWAP[]`` - Push instructio
tests/test_stdlib.py:153
↓ 5 callers
Function
build
Compile doom.doom into a TrueType font. Args: output_path: Override for the output .ttf path. Defaults to ``doom.ttf`` in th
game/build.py:70
↓ 5 callers
Function
build_fpgm_assembly
Build complete ``fpgm`` assembly containing all stdlib FDEFs. Args: func_ids: Optional mapping of function name to its FDEF ID.
compiler/stdlib.py:205
↓ 5 callers
Function
get_function_metadata
Return stack-effect metadata for every stdlib function. This information is consumed by the compiler's stack-depth analyser and register allo
compiler/stdlib.py:86
↓ 5 callers
Method
lookup
Look up a name in the symbol table. Searches constants, then variables, then arrays. Args: name: The identifier to look
compiler/allocator.py:149
↓ 5 callers
Function
tt_div
Simulate TrueType ``DIV[]``: ``(n2 * 64) / n1``. The VM pops n1 (top-of-stack), then n2 (below), and pushes the result. Division truncates t
tests/test_stdlib.py:62
↓ 5 callers
Function
tt_mul
Simulate TrueType ``MUL[]``: ``(a * b) / 64``. The VM pops b (top-of-stack), then a, and pushes the result. Division truncates toward zero.
tests/test_stdlib.py:53
↓ 4 callers
Method
_body
Parse one or more statements until DEDENT (without consuming it).
compiler/parser.py:303
↓ 4 callers
Method
_compile_stmt
Compile a single statement. Args: stmt: An AST statement node. Returns: List of assembly instructions.
compiler/codegen.py:536
↓ 4 callers
Method
alloc_array
Allocate a contiguous range of storage slots for an array. Args: name: Array name. size: Number of elements.
compiler/allocator.py:74
↓ 4 callers
Function
build_font
Build a variable TrueType font from compiled assembly segments. Creates a font with a multi-bar glyph whose geometry is controlled by TrueTyp
compiler/pipeline.py:38
↓ 4 callers
Function
is_wall
Return True if world coordinate (*wx*, *wy*) is inside a wall.
hosts/python/dev_host.py:65
↓ 3 callers
Method
_expr_stmt
Parse a standalone expression (usually a function call).
compiler/parser.py:426
↓ 3 callers
Method
_skip_newlines
Consume any NEWLINE tokens at the current position.
compiler/parser.py:173
↓ 3 callers
Function
create_variable_poc_font
Create a variable TrueType font with a MOVE axis driving bar height. The font contains a single glyph 'A' drawn as a vertical rectangle (4 on
fontgen/variable_poc.py:21
↓ 3 callers
Method
define_const
Register a compile-time constant. Args: name: Constant name. value: Integer value (inlined at every use site).
compiler/allocator.py:135
↓ 3 callers
Function
ideal_fixmul
Reference: exact ``(a * b) / 65536`` with truncation toward zero.
tests/test_stdlib.py:123
↓ 2 callers
Method
_add_expr
``mul_expr (('+' | '-') mul_expr)*``
compiler/parser.py:471
↓ 2 callers
Method
_and_expr
``not_expr ('and' not_expr)*``
compiler/parser.py:447
↓ 2 callers
Method
_mul_expr
``unary_expr (('*' | '/' | '%') unary_expr)*``
compiler/parser.py:480
↓ 2 callers
Method
_not_expr
``'not' not_expr | comparison``
compiler/parser.py:455
↓ 2 callers
Function
_parse
Parse a DSL source string into an AST.
tests/test_codegen.py:59
↓ 2 callers
Method
_unary_expr
``'-' unary_expr | atom``
compiler/parser.py:489
↓ 2 callers
Method
_var_decl
``var IDENT : int ( = expr )?``
compiler/parser.py:202
↓ 2 callers
Function
create_poc_font
Create a proof-of-concept TrueType font with hinting instructions. The font contains a single glyph 'A' drawn as a vertical rectangle (4 on-c
fontgen/poc_font.py:16
↓ 2 callers
Function
gameLoop
()
hosts/browser/doom.js:929
↓ 2 callers
Function
gameLoop
()
docs/doom.js:929
↓ 2 callers
Function
spawnEnemies
()
hosts/browser/doom.js:99
↓ 2 callers
Function
spawnEnemies
()
docs/doom.js:99
↓ 2 callers
Function
strip_comments
(lines: list[str])
tests/test_variable_poc.py:296
↓ 2 callers
Function
strip_comments
(lines: list[str])
tests/test_font_builder.py:221
↓ 1 callers
Method
__init__
(self, source: str)
compiler/parser.py:120
↓ 1 callers
Method
__init__
(self, source: str)
compiler/lexer.py:183
↓ 1 callers
Method
_args
``(expr (',' expr)*)?``
compiler/parser.py:540
↓ 1 callers
Method
_array_decl
``array IDENT [ INT_LITERAL ]``
compiler/parser.py:242
↓ 1 callers
Method
_assignment_or_expr_stmt
Parse IDENT-led statement: assignment, array assignment, or expr.
compiler/parser.py:387
↓ 1 callers
Method
_atom
Parse an atomic expression. ``INT_LITERAL | IDENT '(' args ')' | IDENT '[' expr ']' | IDENT | '(' expr ')'``
compiler/parser.py:496
↓ 1 callers
Method
_comparison
``add_expr (comp_op add_expr)?``
compiler/parser.py:462
↓ 1 callers
Method
_compile_array_access
Compile an array element read: ``arr[i]``. Assembly: compile index, push base, ADD, RS.
compiler/codegen.py:517
↓ 1 callers
Method
_compile_array_assignment
Compile ``arr[i] = expr``. Assembly: compile value, compile index, push base, ADD, SWAP, WS. WS pops index (top) then value (below),
compiler/codegen.py:590
↓ 1 callers
Method
_compile_assignment
Compile ``target = expr``. Assembly: compile expr, push storage index, SWAP, WS.
compiler/codegen.py:568
↓ 1 callers
Method
_compile_binop
Compile a binary operation.
compiler/codegen.py:293
↓ 1 callers
Method
_compile_func_call
Compile a function or intrinsic call.
compiler/codegen.py:374
↓ 1 callers
Method
_compile_get_axis
Compile get_axis(N) intrinsic. GETVARIATION[] pushes N values onto the stack (one per axis). We need to extract the Nth value.
compiler/codegen.py:400
↓ 1 callers
Method
_compile_if
Compile if/else statement. Assembly: compile condition, IF, body, (ELSE, body)?, EIF.
compiler/codegen.py:616
↓ 1 callers
Method
_compile_intrinsic
Compile an intrinsic function call.
compiler/codegen.py:392
↓ 1 callers
Method
_compile_local_var_decl
Compile a local variable declaration inside a function body. Allocates a new storage slot and optionally initialises it. Local variab
compiler/codegen.py:681
↓ 1 callers
Method
_compile_return
Compile a return statement. If there is a return value, compile the expression so it is left on the stack for the caller. If there i
compiler/codegen.py:670
↓ 1 callers
Method
_compile_set_point_y
Compile set_point_y(point_idx, coordinate_funits) intrinsic. Accepts coordinate in font units (0..1000 for a 1000-UPM font) and conve
compiler/codegen.py:456
↓ 1 callers
Method
_compile_unaryop
Compile a unary operation.
compiler/codegen.py:363
↓ 1 callers
Method
_compile_var_ref
Compile a variable or constant reference.
compiler/codegen.py:271
↓ 1 callers
Method
_compile_while
Compile a while loop via recursive FDEF pattern. Each while loop becomes a private FDEF that tests its condition, executes the body i
compiler/codegen.py:636
↓ 1 callers
Method
_const_decl
``const IDENT = INT_LITERAL``
compiler/parser.py:219
↓ 1 callers
Method
_declaration
Parse one top-level declaration.
compiler/parser.py:180
↓ 1 callers
Function
_fixabs_asm
Fixed-point absolute value (thin wrapper around ``ABS[]``). Stack effect: ``..., a -> ..., |a|``
compiler/stdlib.py:181
↓ 1 callers
Function
_fixdiv_asm
Fixed-point 16.16 divide: ``(a << 16) / b``. Stack effect ~~~~~~~~~~~~ :: input: ..., a, b (b on top) output: ..., (a
compiler/stdlib.py:141
↓ 1 callers
Function
_fixmul_asm
Fixed-point 16.16 multiply: ``(a * b) >> 16``. Stack effect ~~~~~~~~~~~~ :: input: ..., a, b (b on top) output: ...,
compiler/stdlib.py:107
↓ 1 callers
Function
_fixneg_asm
Fixed-point negation (thin wrapper around ``NEG[]``). Stack effect: ``..., a -> ..., -a``
compiler/stdlib.py:191
↓ 1 callers
Method
_func_def
``func IDENT ( params ) ( -> int )? : NEWLINE INDENT body DEDENT``
compiler/parser.py:255
↓ 1 callers
Method
_generate_glyph
Emit glyph assembly that calls game_tick (if defined).
compiler/codegen.py:229
↓ 1 callers
Method
_generate_prep
Emit prep assembly for global variable initialisation.
compiler/codegen.py:211
↓ 1 callers
Method
_if_stmt
``if expr : NEWLINE INDENT body DEDENT (else ...)?``
compiler/parser.py:342
↓ 1 callers
Method
_make_token
Construct a :class:`Token`, converting values where needed.
compiler/lexer.py:284
next →
1–100 of 584, ranked by callers