The language is changing. The example houses already use newer forms, such as wings, open spaces and rooms inside rooms, that this reference does not cover yet.

The house language (v0)

A .bim file describes one house: its rooms, the stories they are on and the stairs between them, how big the rooms must be and how they connect, and who asked for each of those things. It says what must be true about the house, not how to draw it; the engine solves the layout. This page is the reference for v0. IDEA.md says why the language looks like this; ARCHITECTURE.md says where the code lives (bim-syntax parses, bim-elab turns the tree into a bim_model::Program).

// A three-bedroom ranch.
house "Oak Ridge Ranch" {
  jurisdiction "us/irc-2021"

  room primary: bedroom
  room bed2: bedroom
  room bath1: bathroom
  room living: living { area ~ 320sqft, width >= 14ft }
  room kitchen: kitchen { width >= 12ft }

  kitchen open_to living
  primary door_to bath1
  prefer bed2 adjacent bath1

  client {
    primary { area >= 150sqft }
  }
}

More: examples/houses/cottage.bim (four rooms), examples/houses/ell.bim (six rooms in an L), examples/houses/ranch.bim (3 bed, 2 bath, with its own wall and window types and a gabled roof; see Assemblies and types and Roofs) and examples/houses/two_story.bim (two stories and a stair, with a flatter roof over the lower story's open part; see Stories and stairs).

At a glance

  • One house "Name" { ... } per file. Inside it: an optional jurisdiction, rooms, relations, and layer blocks that group them.
  • A one-story house lists its rooms directly in the house. A house with more stories puts each story's rooms in a story NAME { ... } block, lowest first, and joins each story to the one below with stair NAME: LOWER -> UPPER.
  • One statement per line. A line break ends a statement; there is no ;.
  • room NAME: KIND { CONSTRAINTS } declares a room. Constraints are area, width or depth compared with =, >=, <= or ~ to a quantity with a unit.
  • A adjacent B, A door_to B, A open_to B relate two rooms, or a room and a stair, on one story; A door_to B cased is a cased opening. Order of statements does not matter: a relation may name a room or stair declared below it.
  • Every statement has a strength, must (the default) or prefer, and an owning layer, designer by default or the layer block it is in.
  • type NAME: KIND { ... } declares a wall, floor, roof or ceiling assembly (its material layers) or a window or door type (its rating); exterior walls: NAME, kitchen walls: NAME, floors: NAME and the like say which elements take it. Without them, every element takes the engine's default type from the catalog.
  • roof gable east pitch 8/12 overhang 18in shapes the roof; without it the house gets a hip roof at 6/12 with a 12 in overhang. roof: NAME (with a colon) is what the roof is made of, and ceiling: NAME the ceiling under it. dormers 2 north and gable north over entry put dormers and small gables on a roof's slopes. See Roofs.
  • front north says which side of the house faces the street: plans are drawn with it at the bottom, and the studio's views face it. See Which way the house faces.

Lexical structure

Source is UTF-8. Non-ASCII text is allowed only inside strings and comments.

Element Form Notes
Comment // ... to the end of the line No block comments. # is an error.
Whitespace spaces, tabs, \n, \r\n A line break separates statements; otherwise whitespace is free. A leading byte-order mark is ignored.
Name [A-Za-z_][A-Za-z0-9_]* Room, story and stair names, room kinds, properties: kitchen, bed2, primary_bath, upper. Case-sensitive.
Keyword see below Reserved: cannot name a room, story or stair.
String "..." Escapes: \" and \\. Must close on the line it opens.
Quantity a number with its unit attached 12ft, 12.5ft, 6'-8", 150sqft, 25%. No space between number and unit.
Number a bare decimal number Only in a window or door type's rating (u_factor = 0.30) and a roof's pitch (6/12). Anywhere else it needs a unit.
Punctuation { } : , = >= <= ~ -> / There is no strict > or <. -> is only for stairs, / only in a pitch.

Keywords: house, jurisdiction, room, story, stair, must, prefer, the layers code, site, client, designer, style, engine, the relations adjacent, door_to, open_to, and for types type, wall, walls, floors, roof, windows, doors, exterior, interior, between, at. Room kinds (bedroom) and properties (area) are ordinary names, so a room may be called kitchen or office. Story names are ordinary names too: main is not reserved. So are the words of a roof statement (hip, gable, shed, pitch, overhang, the sides north ... west): they mean something only after roof. dormer, dormers and gable start a statement only at the start of a line, followed by a side (or, for dormers, a count), and so does front; ceiling starts one only directly before its : (ceiling: attic_r49), so a room may still be called ceiling. Likewise cars, from and cut mean something only at the start of an item in a room's body, and swing, sliding and overhead only after door or a relation's other room, and cased only after door_to's.

Quantities

A quantity is a decimal number (12, 12.5, 0.0625; never negative) followed directly by a unit. Lengths and areas are different types: a width takes a length and an area takes an area.

Unit Kind Example Exact value
ft length 12ft, 12.5ft 12 ft, 12 ft 6 in
in length 30in, 0.0625in 30 in, 1/16 in
' length (feet) 6' 6 ft
" length (inches) 8" 8 in
'-" length (feet and inches) 6'-8" or 6'8" 6 ft 8 in; inches under 12, feet whole
mm length 3500mm 3.5 m
cm length 90cm 0.9 m
m length 3.5m 3.5 m
sqft area 150sqft, 70.5sqft square feet
m2 area 14m2 square metres
% ratio 25%, 22.5% parts per thousand (250, 225): a framing fraction

Values are exact. The engine stores lengths as whole numbers of 100 nm ticks (1 in = 254 000 ticks) and areas as whole square ticks, and converts literals with integer arithmetic. A literal that is not a whole number of ticks (0.00001mm) is an error, never rounded. Units are lowercase; 12feet or 12FT is an error that suggests ft.

Sizes are at most a building's. A length is at most 10,000 ft and an area at most 1,000,000 sq ft, in whatever unit it is written (3048m, 92903m2). Anything larger is an error at the literal (syntax/quantity-too-large), so the engine is never asked to lay out a size no building has, and its arithmetic holds for every size a program can write.

Grammar

EBNF over tokens. NL is a line break (in whitespace or after a comment); it is required between statements and between constraints that are not separated by commas, and is otherwise insignificant.

file         = { house } ;
house        = "house" STRING "{" { house_item } "}" ;
house_item   = jurisdiction | story | stair | type_decl | layer_block | statement ;
jurisdiction = "jurisdiction" STRING ;
layer_block  = layer "{" { statement | stair | type_decl } "}" ;   (* stair, type: at house level only *)
layer        = "code" | "site" | "client" | "designer" | "style" | "engine" ;
statement    = room | relation | type_use | roof_shape | roof_feature | size | outline | front ;   (* each on its own line *)
size         = constraint ;                   (* `area ~ 2300sqft` in the house, `width ~ 31ft` in a story *)
outline      = [ strength ] "outline" NAME ;  (* rectangle *)
front        = "front" NAME ;                 (* a compass side; directly in the house *)

story        = "story" NAME [ "below" "grade" ] "{" { story_item } "}" ;   (* below grade: a basement *)
story_item   = layer_block | statement | over | at_grade | under ;   (* no stair, story, type or jurisdiction *)
over         = "over" NAME { "," NAME } ;     (* places of the story below *)
at_grade     = "at" "grade" NAME { "," NAME } ;   (* compass sides; in a basement *)
under        = "under" NAME { "," NAME } ;    (* places of the story above; in a basement *)
stair        = [ strength ] "stair" NAME ":" NAME "->" NAME [ "{" [ path [ sep landing ] ] [ sep "closet" ] "}" ] ;
path         = ( "up" | "down" ) NAME { "then" NAME } ;   (* compass sides *)
landing      = "landing" NUMBER ( "steps" | "step" ) ( "up" | "down" ) ;

room         = [ strength ] "room" NAME ":" room_kind { compass } [ "unheated" ] [ body ] ;
room_kind    = NAME | STRING ;
body         = "{" [ body_item { sep body_item } [ "," ] ] "}" ;
sep          = "," | NL ;
body_item    = constraint | relation_tail | door | open_sides | cars | cut | type_use_tail | child ;
constraint   = [ strength ] property comparison QUANTITY ;
property     = NAME ;                         (* area | width | depth *)
comparison   = "=" | ">=" | "<=" | "~" ;
relation_tail = [ strength ] relation_kw NAME [ compass ] [ operation ] ;
door         = "door" [ side ] [ operation ] ;   (* no side: a child's door into its room *)
open_sides   = "open" side { side } ;         (* no `{` after it on the line *)
cars         = "cars" NUMBER [ "from" side ] ;
cut          = [ strength ] "cut" corner QUANTITY ;   (* a length; `must` only *)
type_use_tail = ( "walls" | "windows" | "wall" NAME ) ":" NAME ;
child        = room | stair | "closet" [ NAME ] [ ( "at" | "along" ) compass ] [ "unheated" ] [ body ] ;
compass      = side | corner ;
corner       = NAME ;                         (* northeast | southeast | southwest | northwest *)

relation     = [ strength ] NAME relation_kw NAME [ compass ] [ operation ] ;   (* a corner: one the first room cuts *)
relation_kw  = "adjacent" | "door_to" | "open_to" ;
operation    = "swing" | "sliding" | "overhead" | "cased" ;
strength     = "must" | "prefer" ;

type_decl    = "type" NAME ":" type_kind "{" { type_line } "}" ;
type_kind    = "wall" | "floor" | "roof" | "ceiling" | "window" | "door" ;
type_line    = layer_line | rating_line ;     (* one per line *)
layer_line   = NAME QUANTITY [ "between" NAME "at" QUANTITY [ QUANTITY ] ] ;
rating_line  = NAME "=" NUMBER ;              (* u_factor | shgc *)
type_use     = target ":" NAME ;
target       = ( "exterior" | "interior" ) ( "walls" | "doors" )
             | NAME ( "walls" | "windows" )   (* a room's *)
             | "wall" NAME NAME               (* a room and the room, stair or side beyond *)
             | "floors" | "roof" | "ceiling" | "windows" | "doors" ;

roof_shape   = "roof" [ roof_form { side } ] { roof_param } ;   (* at least one word; no `:` *)
roof_form    = NAME ;                         (* hip | gable | shed *)
side         = NAME ;                         (* north | east | south | west *)
roof_param   = "pitch" NUMBER "/" NUMBER      (* rise over run: 6/12, 4.5/12 *)
             | "overhang" QUANTITY ;          (* a length: 12in, 1'-6" *)
roof_feature = ( "dormer" | "dormers" NUMBER | "gable" ) side [ "over" NAME ] [ "width" QUANTITY ] ;

A statement may follow a { on the same line (client { a { area >= 100sqft } }), and a } may end the line of the last statement.

Where each form may appear:

Form Directly in the house In a story block In a layer block
jurisdiction yes no no
story yes no (stories do not nest) no (put the layer block in the story)
stair yes no (it spans two stories) only in a layer block directly in the house
layer block yes yes no (layer blocks do not nest)
room, relation yes yes yes
type yes no (types belong to the house) only in a layer block directly in the house
type use yes floors (that story's), a room's walls or windows, one wall yes
roof shape yes (every roof) yes (that story's roof) yes
dormer, dormers, gable yes (the top story's roof) yes (that story's roof) yes

In a house with story blocks, a room must be inside one (elab/room-outside-story); relations may be anywhere.

Statements

house

house "Oak Ridge Ranch" {
  ...
}

The name is a string, shown on drawings. A file holds exactly one house.

jurisdiction

jurisdiction "us/irc-2021"

The code pack the house is checked against. Optional (the engine's default pack is used without it), at most once, directly inside the house (not in a layer block). Whether the pack exists is checked by the engine, not the language (pack/unknown). A style pack (style/..., see Design advisories) is never a jurisdiction.

room

room kitchen: kitchen { width >= 12ft }
room bed2: bedroom
room mud: "mudroom"

Declares a room named kitchen of kind kitchen. The name must be unique in the house (across all its stories, and not the name of a stair) and gives the room its stable id, room.kitchen, which the lockfile, diagnostics and the GUI use. Renaming a room changes its id.

The kind says what the room is for. Built-in kinds, which code rules know about:

living, kitchen, dining, bedroom, bathroom, half_bath, hall, closet, laundry, entry, office, garage

A bathroom is a full bath: a water closet, a lavatory and a bathtub or shower, which is what the sanitation rule counts (R306.1). A half_bath (a powder room) has a water closet and a lavatory only. It is a wet room like a bathroom for plumbing and ceiling height, and it counts as a bathroom for rule/sleeping-story-without-bath, but not toward the bathrooms the dwelling needs.

An unknown bare kind is an error (elab/unknown-room-kind), with a suggestion when it looks like a typo: bedrom would otherwise silently become a room no bedroom rule applies to. Any other kind is written in quotes: room mud: "mudroom" is a room of kind mudroom (RoomKind::Other), which rules treat as non-habitable. A quoted built-in name ("bedroom") is the built-in kind.

A room is always built: prefer room is an error (elab/preferred-room). must room is allowed and means the same as room.

A hall bends where it must. A hall with nothing written inside it may be an L of two pieces, with no wall between them, so it can step round a room beside it to reach the doors it serves. House 1's hall turns round the closet that juts north out of bedroom 2. Nothing is written for it: the solver lays a story out with every hall a rectangle first, and bends a hall only when that finds no layout, so a house that needs no bend is laid out as if halls could not. A hall bends within the place it is written in (a wing, say), round a room of that place, its upright a strip as tall as the part of the story it turns in; it does not yet turn where rooms stand beside both its arms. Its area is that of both pieces, and an L costs a little more than a rectangle.

Heated, unheated and open rooms

room storage: closet northeast unheated { door_to carport }
room carport: garage southeast {
  door_to living
  open south east          // no walls here: posts hold the roof up
}
room garage: garage east { door_to kitchen }   // walled in on every side

Every room is heated or not. unheated after a room's kind (or a wing's name) puts it, and everything inside it, outside the heated envelope. A garage is always unheated. A wall between a heated and an unheated room is of the exterior class: it takes the exterior wall type, and its doors are exterior doors. It is still indoors on both sides, so it gets no windows, and the glazing, ventilation and escape-opening rules do not count it.

open SIDE... in the body of an unheated room lists the sides with no wall, separated by spaces. The room touches that side of its story, as room carport: garage southeast does, and the solver keeps it there. Where it meets the outdoors on that side there is an open edge instead of a wall: dashed on the plan, the roof above it, and a post at each end where no wall ends and between, no more than 10 ft apart (an engine default, not code). No post stands where cars drive through: across the open side a garage's cars drive in from (cars 2 from east with open east), or in front of an overhead door that opens onto the room (a garage door onto a covered drive). The beam over that stretch spans it, to a post beside it only where the rest of the side is longer than the spacing. The same statement makes a porch: room porch: "porch" unheated { open south }.

A porch lights the rooms behind it. The code lets a room's required windows face into a roofed porch instead of straight outdoors, when the porch abuts a yard or street, its longer side is open enough and its ceiling is high enough (an exception in R303; porch.light_min_open_share and porch.light_min_ceiling in the pack, 65 % and 7 ft in the IRC). A porch here is an unheated room other than a garage that is open on some side; it meets the exception when the open edges along one of its longer sides make up that share of it, under its story's ceiling. Then a habitable room's window may go in its wall onto the porch, and the glazing and ventilation rules count it. An escape opening still opens outdoors, so a bedroom keeps its window in an exterior wall. A room that takes its light only through a porch should say it is beside it (office adjacent porch), so the solver does not look for an outside wall of its own.

Doors and cars

room bed1: bedroom {
  door_to hall east                        // in bed1's east wall
  closet at southeast                      // a bedroom's closet: its door slides
}
room living: living { door south }         // the front door; it swings
room garage: garage north {
  cars 2                                   // two cars side by side
  door north                               // an overhead door, 16'-0" wide
  door west swing                          // a door to the yard
}
room carport: garage southeast { cars 2 from east, open south east }
room tuckunder: garage west {
  cars 1                                   // through its door to the drive
  door_to drive north overhead             // an overhead door, 9'-0" wide
}
room drive: "drive" northwest unheated { open north west }  // roofed, open

door SIDE [OPERATION] in a room's body is an exterior door in the room's wall on that side of its story. How a door opens is one of swing (the default), sliding (panels that slide along the wall, like a closet's bypass doors) and overhead (a vehicle door). In a garage, door SIDE is an overhead door unless an operation is written. A door to another room is overhead when its relation says so (door_to drive north overhead, a garage behind a covered drive); it is the same door as an exterior one: as wide as the cars that drive through it need (see cars) and 7'-0" high. The plan draws a sliding door's two panels and an overhead door's track (dashed, rising into the garage) instead of a swing; IFC records the door's operation type. A sliding or overhead door is not side-hinged, so it is not the egress door (R311.2), nor the house's way in: a house whose only doors of its own slide or rise gets the engine's entry door too.

door OPERATION with no side, in a child's body, says how its door into its room opens: closet linen { door sliding } in a hall. A room that is no child has no such door (elab/door-without-side).

A closet in a bedroom slides. When nothing says how it opens, in the child or on a relation between the two (bed1_closet door_to bed1 swing), a closet's door into the bedroom it is in is a sliding door, as most bedroom closets are reach-in, behind bypass doors (an engine default, not code: bim explain lists it as the engine's). Every other child's door swings, a linen closet's in a hall among them. The language does not yet tell a walk-in from a reach-in, so write a walk-in closet in a bedroom door swing: closet at northwest { area ~ 60sqft, door swing }. One written as a room beside the bedroom (room wic: closet { door_to primary }) is no child, and its door swings.

door_to ROOM cased is a cased opening: a wide doorway with no door, in the wall between the two rooms, which stays. It is as wide as the wall they share less a 6 in return at each end, and 6'-8" high, with a header over it; the plan shows the gap and its jambs, the 3D view its frame, and IFC an opening with no filling. Use it where a room opens into the next through a wall, a hall into a living room, say; where nothing stands between them, write open_to (see Relations). cased follows only door_to's room: after adjacent or open_to it is elab/operation-without-door, and after door (an exterior door, or a child's door into its room) elab/cased-door, since a cased opening joins two rooms. A child that opens into its room through one writes the relation itself: door_to entry cased.

A relation may name a side and an operation: door_to hall east sliding in bed1's body (or bed1 door_to hall east sliding). The side is of the relation's first room: the hall meets bed1 along bed1's east side, and the door is in that wall. The side is held at the relation's strength, like the relation. Only a door has an operation (elab/operation-without-door). Two rooms meet along a side, so a corner there is an error (elab/relation-at-corner), except a corner the first room cuts, which puts the door in the cut wall (see Cut corners).

cars N [from SIDE] in a garage: it holds N cars side by side, driven in from that side. The garage is at least N stalls across that side and a stall deep, a stall being 10'-0" by 20'-0" (engine defaults, not code), as must bounds written where the statement is. Its overhead doors on that side are 9'-0" wide for one car and 16'-0" for more, exterior ones and those to another room alike; every other overhead door is 9'-0" wide. A door to another room is on the side of the garage its relation names (door_to drive north, or garage south written from the drive); one whose side is not written is on no side the cars can be known to drive in from. Without from, the cars drive in through the garage's one overhead door, if its side is known, or its one open side. Two rooms with an overhead door between them share a wall as long as the door and a 6" return each side.

A garage open on at least two sides is a carport (R309.2; carport.min_open_sides in the pack). The egress path treats a carport on the lowest story as outdoors: a room with a door into one has a way out, and a path through it does not go through a garage. A garage open on one side is still a garage.

Cut corners

room office: office east {
  area ~ 130sqft
  cut southwest 4ft              // its corner toward the entry, cut at 45°
  door_to entry southwest        // the door in that cut wall
  adjacent porch
}
room entry: entry

cut CORNER LENGTH in a room's body cuts that corner of the room off at 45°. Rooms are still solved as rectangles; the cut takes the triangle at the corner off the room, its two legs LENGTH long, back from the corner along each of the room's two sides there, and gives it to the room beyond the cut. The wall between them runs across the corner, along the triangle's long side, at 45°: the one wall that is not square to the compass. The room beyond must meet the room along at least one of the two legs, so the cut faces indoors and the story's outline is the same as without it; the solver keeps a room there. The room's area is its rectangle's less the triangle, and the room beyond gains it.

door_to ROOM CORNER names the cut corner for its door: door_to entry southwest in the office's body (or office door_to entry southwest) puts the door in the cut wall, and the entry is the room the cut faces. open_to leaves no wall there, only a boundary across the cut, door_to entry southwest cased puts a cased opening in it, and adjacent says which room the cut faces with no door. A door's operation still follows (door_to entry southwest sliding). The corner is the relation's first room's, as a side is: written from the other end, entry door_to office southwest is an error (elab/relation-at-corner), whose note says to write it from the office. A cut faces one room, so a second room through the same cut is an error (elab/cut-faces-one-room).

  • A cut is always as written: prefer cut is an error (elab/preferred-cut); must cut means the same as cut. It is held at the room's layer.
  • A cut is at a corner: cut south 4ft is an error (elab/cut-at-side), and so is a second cut at one corner (elab/duplicate-cut). A room may cut several corners.
  • LENGTH is a length more than zero (elab/invalid-cut; an area or a percentage is elab/unit-mismatch).
  • A room with children may be cut, but a child may not, yet (elab/cut-on-child): it lies inside its room.
  • A cut is part of the design, so it is written where the tree declares the room, not in a layer block's refinement (elab/brief-cut).

Constraints

room living: living { area ~ 320sqft, width >= 14ft }
room primary: bedroom {
  area >= 150sqft
  width >= 12ft
  prefer area ~ 180sqft
}

Inside a room's braces, each constraint bounds one dimension. Separate constraints with commas or line breaks; a trailing comma is fine.

Property Means Takes
area floor area an area (sqft, m2)
width east-west extent a length
depth north-south extent a length
Comparison Means
= q exactly q
>= q at least q
<= q at most q
~ q about q: a target the solver aims for and may miss

A constraint has its own strength (prefer width >= 14ft) and takes the room's layer. A room may have several constraints on one dimension; the "must" ones must agree (see elab/contradiction).

Relations

kitchen open_to living
primary door_to bath1
prefer bed2 adjacent bath1
Relation Means
a adjacent b the rooms share a wall long enough for a door
a door_to b adjacent, with a door between them
a open_to b adjacent, with no wall between them where they meet: one space
a door_to b cased adjacent, with a cased opening (a doorway with no door) in the wall between them

Rooms open to each other have no wall between them. Where they meet, nothing is built: the line between them is a boundary (boundary.<a>.<b>, the rooms' names in order), dashed light on the plan where one room's floor ends and the next begins, absent from the 3D view, and an IfcVirtualElement in IFC, so a tool reading it knows where each space ends. bim explain gives the open_to (or the open space) as its reason. No post stands on it: the roof or floor above spans it. A room's clear floor runs to a boundary, not to a wall face. Two rooms open to each other are both heated or both unheated: a heated room open to an unheated one would leave the heated envelope open (elab/open-to-unheated). So a porch may be open to a covered drive in front of a garage (porch open_to drive, house 2), and a kitchen to a living room, but not a kitchen to a garage or a porch.

Both names must be declared rooms or stairs (anywhere in the house), and different, and both must be on one story: see Relations across stories. A relation may name the side of its first room the other meets (bed1 door_to hall east), or a corner its first room cuts (office door_to entry southwest): see Doors and cars and Cut corners.

Stories and stairs

house "Maple Two-Story" {
  story main {
    room living: living { area ~ 300sqft }
    room kitchen: kitchen
    room hall: hall
    kitchen open_to living
    hall door_to living
    hall open_to main_stair          // where you step onto the stair
  }
  story upper {
    room primary: bedroom
    client {
      primary { area >= 160sqft }
    }
    room bed2: bedroom
    room bath: bathroom
    room landing: hall
    primary door_to landing
    bed2 door_to landing
    bath door_to landing
    landing open_to main_stair       // where you step off it
  }
  stair main_stair: main -> upper
}

story

story upper {
  room landing: hall
}

A story block holds the rooms on one story and the relations between them. Stories are listed lowest first: each block sits on the one before. The first is the ground story, where people arrive, unless it is a basement (below grade, see Basements); then the ground story is the one over it. There are no split levels or mezzanines yet; a story is a full floor.

The name is a plain name (it becomes part of file names downstream, such as a floor plan per story) and gives the story its id, story.<name>. Story names are unique in the house, and two names that differ only in case (upper, Upper) count as the same (elab/duplicate-story). A story must have at least one room (elab/empty-story). A story has no strength (it is always built, so prefer story and must story are errors) and no layer (it is always the designer's), but a layer block inside it works as at the house level.

A house with no story block is a one-story house. Its one story is named main (story.main), and its rooms are written directly in the house, as in the examples above. Once a house has a story block, every room must be in one (elab/room-outside-story): a house is either flat or divided into stories, never both. A single story block is allowed and makes a one-story house whose story has that name.

Room names are unique across the whole house, not per story, so hall names one room wherever it is used.

A story's size, shape and place

house "House 2" {
  area ~ 2300sqft                // heated floor area of the whole house
  story main {
    outline rectangle            // no notch
    width ~ 31ft                 // east-west, outside to outside
    depth ~ 48ft                 // north-south
    ...
  }
  story upper {
    over garage, front, great    // the places of the story below it lies over
    ...
  }
}

Size. width, depth and area written directly in a story block, with the comparisons, strengths and layers of a room's constraints, bound the story: width and depth its bounding rectangle on wall centrelines, east-west and north-south, and area its heated floor area, its heated rooms and its stairs. In a house with no story blocks they are written directly in the house. area written directly in a house with stories bounds the heated floor area of the whole house, which is what its square footage means: garages, carports and porches are not in it. The solver lays stories out one at a time, so each story takes the share of the house's area that its heated rooms' and stairs' target areas are of the house's; the explanation says so. A miss on a story's width or depth costs the floor of the strip it adds or takes away, so it weighs against the rooms' areas in the same terms. Bounds that cross are elab/contradiction; width or depth directly in a house with stories, or a size in a wing or an open space, is elab/misplaced-size.

Outline. outline rectangle in a story (or a house with no story blocks) says its outline is a plain rectangle: the solver searches no layout with a notch, and a conflict names the statement. prefer outline rectangle costs each notch instead. A rectangle is the only shape so far: an L, a T or a U is elab/unknown-outline, and two outline statements for one story are elab/duplicate-outline.

Over. over PLACE, ... in a story above another names the rooms, wings and open spaces of the story below that it lies over, and it lies over nothing else of that story; the stairs between them always count. Without it, a story lies anywhere over the story below. The story below holds it up with those places only. It is always a must (elab/preferred-over); a place that is not on the story directly below is elab/unknown-over, one named twice elab/duplicate-over, and over on the lowest story, in the house, in a wing or over a basement (which says what it lies under instead) is elab/misplaced-over.

Basements

house "Walkout" {
  story lower below grade {
    at grade west                  // the ground falls to the west
    under bedrooms, great          // not under the carport
    room rec: living { area ~ 900sqft, open_to stairs }
    room out: hall west { door west }   // the walkout door
  }
  story main {
    wing bedrooms west {
      room bed: bedroom { door_to living }
      room bath: bathroom { door_to bed }
    }
    open great {
      room kitchen: kitchen north
      room living: living south { door south }
    }
    room carport: garage east { cars 2 from east, door_to living, open south east }
  }
  stair stairs: lower -> main { down south }
}

below grade after a story's name makes it a basement: below the ground, with the story over it as the ground story. A house has at most one basement, it is the first story listed, and a story stands on it. Elevations are measured from the ground story's floor, so a basement's is negative. Everything else works as in any story: rooms, places, sides, relations, layer blocks and the stair up.

at grade SIDE, ... in a basement says the ground comes down to its floor along those sides of the rectangle bounding it (north, east, south, west, as for places). Along every other side it is buried, notches included. It is a must statement with its block's layer:

  • a buried wall is a foundation wall: it takes the foundation walls type (the catalog's 8 in concrete wall by default, Type uses), and no window or door goes in it; a door SIDE on a buried side is elab/door-on-buried-side;
  • a room's window goes in a wall on a side at grade; a room that may sleep must reach one, for its escape opening, or the conflict names the rule and below grade. Light and ventilation are not asked of a room below grade: one that reaches a side at grade gets its window there, and one that does not is reported as an advisory;
  • nothing of the story above stands out past a side at grade, over ground a story down: on that side the basement lines up with the house without a statement saying so, and a layout that needs floor out there is a conflict naming at grade;
  • the ground at each wall follows: a basement's wall at grade has it at the basement's floor, and so does a wall of a story above on the same side, a story or more down. The egress door must be level with the ground at its wall (on the ground story, or the basement's walkout door), and a window over a walkout is no grade-floor escape opening. With no at grade, a basement is buried all round.

under PLACE, ... in a basement names the rooms, wings and open spaces of the story directly above that it lies under: under their floor, what is written in them, and the stairs. It may be smaller than them, and it covers nothing of the story above; that story is held up over it by those places only. Without under, a basement lies anywhere under the story above, not necessarily all of it. It is a must. over says the same thing from above, so the story over a basement does not use it.

What the main floor stands on where there is no basement under it is not stated: its property sheet gives the area over the basement and the area on the ground, with "foundation not stated".

These are errors: below grade on a story that is not first (elab/basement-not-lowest), with no story over it (elab/basement-alone) or on a second story (elab/two-basements); at grade or under outside a basement's own block (elab/misplaced-basement-statement), with prefer (elab/preferred-basement-statement), a side twice (elab/duplicate-grade-side), all four sides (elab/every-side-at-grade: the story is not below grade), a corner (elab/grade-at-corner); a name in under that is no place of the story above (elab/unknown-under), a stair, a story or one of the basement's own rooms (elab/under-not-a-place), or one named twice (elab/duplicate-under).

stair

stair main_stair: main -> upper

Declares a straight stair named main_stair rising from story main to story upper, read "from main up to upper". Its id is stair.main_stair. The engine sizes it (rise, run, width) from the code pack, and with nothing more said runs it whichever way the house fits best. Its body can say which way it runs, and where it turns: see Which way a stair runs.

  • A stair is written directly in the house, usually after the story blocks, because it belongs to two stories. One written in a story block is a syntax error (syntax/misplaced-item) that still counts as the stair, so the story is not also reported as unreachable. A stair may be in a layer block that is directly in the house (client { stair ... }), which makes it that layer's.
  • It joins a story to the story directly above it: the lower story comes first, and the two are next to each other in the list (elab/stair-reversed, elab/stair-skips-story, elab/stair-same-story, elab/unknown-story). A three-story house has a stair main -> upper and another upper -> attic.
  • Every story above the lowest needs a stair from the story below it (elab/missing-stair). More than one stair between the same two stories is fine.
  • A stair is always built: prefer stair is an error (elab/preferred-stair); must stair means the same as stair.
  • Stairs and rooms share one set of names, so a stair cannot have a room's name (elab/duplicate-stair, elab/duplicate-room), and a relation names either by name alone.

Which way a stair runs

house "Stair Paths" {
  story main {
    room living: living {
      // Going up you walk east, reach a landing, turn and walk north.
      stair up_stair: main -> upper at southeast { up east then north }
    }
  }
  story upper {
    room landing: hall { open_to up_stair }
  }
}

A stair's body holds its path: the sides you walk on it, in order, going up or going down. Write it the way you would describe the stair: a basement stair from the top (down south then west), a stair to a bedroom floor from the bottom (up east then north). Both words describe the same thing, so down south then west and up east then north are one stair.

Path Stair
up north one straight flight, rising north
up east then north an L: a flight rising east, a landing at the turn, a flight rising north
up north then east then south a U: a flight rising north, a landing you cross walking east, a flight rising south beside the first
  • The sides are compass sides; a corner is an error (elab/invalid-stair-path). So is a turn that does not change direction (up north then north), a U written without the way across its landing (up north then south, which does not say which side the second flight is on), and a path with more than one landing.
  • Where the landing is on the rise can follow the path, counted in steps (risers) from either floor: { down south then west, landing 3 steps up } puts it three risers above the lower floor, and landing 12 steps down twelve below the upper. Without it the engine splits the risers between the flights as evenly as it can (the lower flight takes an odd one). The flights are as long as their steps, so a landing near the bottom makes an L with a short first leg and a long second one. A landing on a straight stair, or with no path, is an error (elab/stair-landing-without-turn), and so is a second one (elab/duplicate-stair-landing). How many risers a stair has comes from the story's height and the code pack, so a landing at least that many steps from a floor is reported when the house is solved (solve/stair-landing-off-the-stair).
  • The landing at the turn is at least as wide as the stair and as deep as the code's landing.
  • A path is always as written: prefer is an error (elab/preferred-stair-path), and a stair has one path (elab/duplicate-stair-path).
  • up, down, then, landing and steps are words only in a stair's body: a story may be called up, a room landing.
  • Without a path a stair is one straight flight, run north-south or east-west, whichever the house fits best.

A closet under the stair: closet in its body makes the space under its flight a closet, walled in, with its door at the flight's high end (opposite its foot, where there is headroom): { up north, closet }. The door, door.<stair>.closet, is 2'-0" wide (an engine default, not code) and opens into the room at that end on the lower story, which the solver puts there. A closet goes under a straight stair only for now (elab/stair-closet-on-turn), and a stair has one (elab/duplicate-stair-closet). The plan names it CLOSET under the flight. The code wants gypsum board on the enclosed side of its walls, underside and soffits (R302.7; rule/under-stair-protection checks the walls, the only part the model has).

Which way the house faces

house "House 2" {
  front north        // the street is to the north
  ...
}

front SIDE, directly in the house (or a layer block there), names the side that faces the street. Sides keep their compass meaning: garage northwest is still the northwest corner. What faces the front is how the house is shown: the floor plans are drawn with the front at the bottom of the page and a north arrow, the studio's 3D view opens on the front (and the side to its right), and the walkthrough starts at the front door, the door out of the house on that side (onto a porch counts). Without front the house faces south, the engine's choice, and north is up on its plans. It names a side, not a corner (elab/front-at-corner); it is written once (elab/duplicate-front) and never in a story, wing or open space (elab/misplaced-front) or a room (syntax/misplaced-item).

Relations across stories

Both ends of a relation must be on one story. A stair is on both stories it joins: it is a flight on the lower story and an opening in the floor of the upper one, in the same place. So the stair above relates to hall on main and to landing on upper, and those are the only ways from one story to the other. A relation between rooms on different stories is an error that names both stories (elab/cross-story-relation).

With a stair Means
hall open_to main_stair you step onto (or off) the stair from this room: no wall at that end
hall door_to main_stair a door between the room and the stair, as at the top of a basement stair
closet adjacent main_stair the room shares a wall with the stair
garage adjacent main_stair east the room shares a wall with the stair on the room's east side; main_stair adjacent garage west says the same, from the stair

A relation between two stairs is an error (elab/stair-to-stair). Usually each stair has one open_to on each of its stories, saying where it starts and where it arrives. It can have no more: a stair has one foot on its lower story and one head on its upper, and the room you step on or off from covers that end, so a second room that door_to or open_to one end is an error (elab/stair-end-taken). A room beside the stair is adjacent to it.

A stair stands in the open space it opens into. Where a room of an open space is open_to a stair (a must, not a prefer), the stair is part of that open space on that story: the space's region holds the stair as it holds its rooms, so its rooms may wrap round it, and a stair can stand free in the middle of an open living area, or come up in the middle of a loft. A stair written in a room stands in that room (and the places holding it) on the room's story, and on its other story in the open space it opens into there. Opening from a room in a wing, or through a door, puts it in no place: it stands beside the room.

story main {
  open great {
    room living: living { open_to stair1 }   // the foot: the stair stands in `great`
    room kitchen: kitchen
    room dining: dining
  }
}
story upper {
  open upstairs {
    room loft: living { open_to stair1 }     // the head: it stands in `upstairs` too
    room hall: hall
  }
}
stair stair1: main -> upper { up north }

The rooms of an open space open into each other wherever they meet. No relation is implied between them, and none is needed: the solver keeps the open space in one region, and every two of its rooms that the layout puts side by side meet with no wall between them, at a boundary credited to the open statement, as for open_to. So a door or a cased opening between two of them is an error (elab/door-in-open): take one out of the open space to put a wall between them. An open space's rooms are all heated or all unheated (elab/open-to-unheated).

A relation may be written in a story block or directly in the house. Written in a story block, its ends must be on that story (elab/misplaced-relation); written in the house, it is on whichever story its ends share.

Assemblies and types

type cedar_2x6: wall {
  wood_bevel_siding 0.5in                                   // outside first
  xps_board 1in
  osb 0.4375in
  mineral_wool_batt 5.5in between softwood_lumber at 24in   // a framed layer
  gypsum_board 0.5in
}
type picture: window {
  u_factor = 0.27
  shgc = 0.30
}

exterior walls: cedar_2x6
windows: window_triple_low_e      // a catalog type, by name
living windows: picture
laundry walls: quiet_2x4          // every wall of one room
wall primary hall: quiet_2x4      // the wall between two rooms
wall kitchen north: cedar_2x6     // a room's exterior wall on one side

As in Revit, and in IFC's type/occurrence split, what an element is made of is a type shared by every element of that type. A wall, floor, roof or ceiling type is an ordered material layer set; a window or door type is a unit with a whole-product rating. Each element takes exactly one type, and the engine rates each type's heat loss (see ARCHITECTURE.md, "Thermal values by the parallel-path method").

type

type NAME: KIND { ... } declares a type. Its id is type.<name>. Type names are unique in the house and separate from room and story names; a type may have the name of a catalog type, which it then replaces in this house. The kinds:

Kind Body Order
wall layers outside first
floor layers top first, down to the ceiling below
roof layers outside first: what the roof's planes are made of, the deck (shingles, sheathing, rafters); their sum is the planes' depth
ceiling layers top first: the ceiling under a roof, which holds a vented attic's insulation; its U-factor applies to the part of the story the roof covers (see Roofs)
window u_factor = N, optionally shgc = N
door u_factor = N

A layer is a material from the catalog and its thickness: gypsum_board 0.5in. The catalog (catalogs/*.toml) gives each material's thermal resistance and density, with a citation; the source never states them. A framed layer names its cavity fill first, then the framing members and their spacing, centre to centre: fiberglass_batt_r13 3.5in between softwood_lumber at 16in. Its framing fraction (studs, plates and headers as a share of the area) comes from the catalog's table for the kind and spacing, or is stated after the spacing: at 24in 20%. An assembly has at most one framed layer.

Each layer has a role (structure, framing, cavity fill, sheathing, exterior insulation, cladding, roofing, lining, finish or air), its material's default in the catalog: gypsum_board lines, osb sheathes. A framed layer is built as two parts, its members (framing) and its fill (none when the fill is air). The role and the kind of element decide the construction step the layer goes up in (catalogs/stages.toml: a wall's OSB with its story's walls, a roof's in roof sheathing); bim explain on a layer (wall.3.layer.2) says which and why. A layer whose role the table does not place for its kind of element is an error, stage/unmapped.

A rating is a unit's label values, as bare numbers in the US units NFRC labels use: u_factor in Btu/h·ft²·°F (above 0) and, for windows, shgc (0 to 1).

A wall's thickness is the sum of its type's layers, and a floor's or a roof's depth likewise; all are known before the layout is solved. A story's floor-to-floor height is its ceiling height plus the depth of the floor above it (for the top story, of the house's default floor type), and its stair rises exactly that (risers are whole sixteenths of an inch, so the clear ceiling may come out a fraction of an inch under 8'-0").

Type uses

TARGET: NAME gives the type NAME (one the file declares, or a catalog type such as wood_stud_2x4_r13) to some elements:

Target Elements Where
exterior walls, interior walls, foundation walls every wall of the class (foundation: a basement's buried walls) the house
ROOM walls every wall bounding the room anywhere
wall ROOM OTHER the wall between the room and room or stair OTHER anywhere
wall ROOM SIDE the room's exterior wall (or walls) on north, east, south or west anywhere
floors every story's floor; in a story block, that story's house or story
roof every roof's planes the house
ceiling the ceiling under every roof the house
windows, ROOM windows every window, or the room's house; a room's anywhere
doors, exterior doors, interior doors every door, or those in walls of the class the house

The most specific use wins: one wall over a room's walls over a class; a story's floor over floors; a room's windows over windows; exterior doors over doors. When both rooms either side of a wall name a type for their walls, the higher layer wins, then the room first by name (the order statements are written in decides nothing); write wall A B: NAME to settle it. A use takes its layer from its block like any statement, but it has no strength: an element always takes its type (must or prefer on one is a syntax error). Naming the same target twice is an error. A use that ends up giving its type to nothing (a wall a b for rooms the layout does not put side by side) is a warning, type/unused.

Engine defaults. With no use for them, elements take the catalog's defaults ([defaults] in catalogs/assemblies.toml): a 2x6 R-21 wall outside, a 2x4 partition inside, 8 in of bare concrete for a basement's buried walls, a 2x10 joist floor, an asphalt shingle roof on 2x6 rafters over an R-49 attic ceiling, double-glazed low-e windows, insulated steel exterior doors and hollow-core interior doors. These are statements of the engine layer, so any use outranks them, and the property sheet says when a value is a default.

Roofs

examples/roofs/ has a program for each style: hip, gable, hip with one gable, shed, cross gable and a lean-to.

roof gable east pitch 7/12 overhang 18in   // the house's roofs
roof: asphalt_shingle_2x6_rafters          // what they are made of
ceiling: attic_r49                         // the ceiling under them
story main {
  roof pitch 4/12                          // the roof over this story's open part
}

roof followed by words (no :) shapes the roof; roof: NAME gives its planes their type, and ceiling: NAME the ceiling under it its type. The three are separate statements and any may be left out.

A roof and the ceiling under it are separate types, because they are separate things. Over a vented attic the roof is a deck, shingles on sheathing on rafters, about 6 in deep, and the insulation lies flat on the ceiling below, with the attic's ventilated air between them. So the roof type gives the planes their depth, drawn plumb in 3D and exported as the roof slabs' layers in IFC, and the ceiling type gives the heat loss: its U-factor times the part of the story the roof covers, in the roof's and the story's property sheets and on the ceiling's IfcCovering in IFC. Were they one type, a low porch roof would be drawn as thick as an attic's insulation.

Which roofs a house has

Every story has a roof over the part of it that no story above covers: the top story's whole outline, and on a lower story any part that sticks out past the story above (a one-story wing, a bump-out). Each is one element, roof.<story> (its planes are roof.<story>.1, roof.<story>.2, ... in order of slope then outline). A roof sits on its story's wall plates: its underside meets the top of the walls at their outer face. A lower story's roof runs up to the outer face of the walls above it and stops there, as against a gable end: those edges have no eave, so its slopes rise toward the wall and die into it (a hip roof against a wall, or with shed, a lean-to).

A window stays clear of a roof below it. Where a lower story's roof runs up against a wall with a window in it (a porch roof under the upper story's front windows), the roof is flashed up the wall, so the window's sill is raised to 4 in above the roof's top there (an engine default, not code). The window keeps its height while its head stays 12 in under the ceiling, for a header; past that it is made shorter and wider by as much glass, where its wall has room. The roof's statement joins the window's reasons, so bim explain says why its sill is where it is. A window that cannot clear the roof (an escape window whose sill would pass the code's highest, or one whose wall has no room to widen it) stays behind the roof, with a warning, solve/window-under-roof; a flatter or shallower roof meets the wall lower.

Shape, pitch and overhang

Form Means
roof hip every side slopes up from an eave: a hip roof. The default.
roof gable SIDE... a hip roof with gable ends on the sides named (north, east, south, west): the slopes beside a gable side run out to it, and the end wall is carried up to the roof
roof gable gable ends on the two ends of the roof's longer axis (east and west when it is at least as wide as it is deep)
roof shed SIDE one slope (more on an outline that is not a rectangle) falling to the side named; the other sides are gable ends
Parameter Takes Default
pitch RISE/RUN two plain decimal numbers: 6/12, 4.5/12, 1/2. Stored exactly, in lowest terms; never a float. Between 0 (exclusive) and 24/12 6/12
overhang LENGTH how far eaves and rakes reach past the walls' outer faces, at most 4'-0" 12in

All of a roof's planes have one pitch. Each word is optional, in that order: roof pitch 8/12 changes only the pitch.

A side picks out the edges of the outline facing that way whose two corners are both outside corners: the end of a wing, or the whole side of a rectangle. An edge that ends at an inside corner keeps its eave, because a gable there would leave the slope beside it with nothing to meet. A named side with no such edge is a warning, roof/no-gable-end, and that side stays hipped. Likewise a shed's high sides slope where they meet its eave at an inside corner; on a rectangle a shed is one plane.

Statements and defaults

A roof statement directly in the house (or a layer block there) shapes every roof; one in a story block shapes that story's roof. Each of the form, the pitch and the overhang comes from the story's statement if it has it, else the house's, else the engine's default (a hip roof at 6/12 with a 12 in overhang, Origin::ENGINE, which the property sheet shows as a default). So roof gable in the house and roof pitch 4/12 in story main make a gabled main roof at 4/12. A roof statement has no strength (must or prefer on one is a syntax error) and takes its layer from its block.

Dormers and gables

dormers 2 north                       // two dormers on the north slope, spaced evenly
dormer south over bed2 width 6ft      // one, lined up with a room
story main {
  roof hip pitch 4/12                 // a porch roof
  gable north over entry              // a small gable on its eave, over the entry
}

A dormer is a box standing on a slope with a window in its front and a gable roof over it; a gable here is the same small roof with no walls under it, its front on the eave, like the gable over a porch's entry. Each faces a side and stands on the slope that falls to that side.

Part What it says
dormer SIDE one dormer on the slope falling to SIDE
dormers N SIDE N of them, two or more, spaced evenly: each in the middle of an equal share of the length
gable SIDE a gable on that slope's eave
over PLACE lined up with a room, wing or open space on the roof's story: in the middle of its extent along the eave, or for dormers N, of each equal share of it. Without it, the whole roof's
width LENGTH across its front; the engine's default is 5'-0" for a dormer, 8'-0" for a gable

Written in a story block, it is on that story's roof; directly in the house, on the top story's. Elsewhere it is an error (syntax/misplaced-item in a room, elab/misplaced-roof-feature in a wing or open space).

Its roof has the pitch of the roof it stands on, so it takes no pitch or overhang: its valleys run at 45 degrees on the plan and every height stays exact. Its ridge runs up the slope from its front until the two meet. A dormer's front stands 2'-0" up the slope from the outer face of the wall below, and its walls are 4'-0" high to its eaves, with a window 2'-0" narrower than the dormer and 3'-0" tall (all engine defaults, not code); so it needs enough slope, which a low pitch may not have (a dormer reaches 8'-6" up an 8/12 slope). A gable's front is on the eave, and reaches up the slope half its width.

The plane under a feature is cut away round it. The feature is two more planes of the roof, numbered after the others, and itself an element of the roof, roof.<story>.dormer.<n> or roof.<story>.gable.<n>, numbered by side and then along it. Its valleys are valleys, its ridge a ridge, its front's sloping edges rakes and a dormer's side edges eaves; where its walls stand on the slope, the roof's lines there are abutments. The roof plan draws them all; a floor plan draws only the roof's outer edge. In 3D a dormer's walls are as thick as the gable ends, and its window is a hole with a pane.

A dormer lights the attic, not the rooms below: every room has a flat ceiling. A feature that does not fit on one plane of its slope, clear of hips, valleys, the ridge and any wall above, or that overlaps another, is a warning, roof/feature-does-not-fit, and is left out.

Geometry

The planes come from a straight skeleton of the roof's eave outline (the story's outline grown by the overhang and half the exterior wall), which on a rectilinear plan keeps every corner exact; see ARCHITECTURE.md. Heights are exact whenever the pitch's run divides half the planning grid, which every x/12 pitch does on the 6 in grid (the eave line is moved out by under 5 micrometres to make that so); other pitches round heights to the nearest 100 nm.

Strength and layers

Every statement (room, constraint, relation) has an owner, its layer, and a strength. This is how the engine knows what it may trade away and who to blame for a conflict.

Strength. must is a hard constraint: all of them hold at once, and a conflict between them is an error. prefer is a soft preference, weighed against the others. A statement without a strength keyword is must. Strength belongs to the statement, never to a block.

Layers. A statement belongs to the layer block it is written in, and to designer when it is directly in the house. When preferences pull against each other, the higher layer wins:

Layer Owner Write it?
code building code and law No: comes from code packs. Writing it warns (elab/reserved-layer).
site survey and zoning Yes, for site facts.
client what the client asked for Yes: the usual block.
designer the designer's or agent's decisions The default; no block needed.
style style and regional defaults Yes, for overridable defaults.
engine the engine's own defaults No: writing it warns (elab/reserved-layer).
room primary: bedroom                         // designer, must
client {
  primary { area >= 150sqft }                 // client, must
  prefer bed2 adjacent bath1                  // client, prefer
}

Layer blocks refine the rooms the design declares, by name (primary { area >= 150sqft }), and hold relations (and, directly in the house, stairs), and do not nest. A room declared in a layer block is an error (elab/declaration-in-brief), and so is a name the design does not declare (elab/undeclared-space). A layer block may be inside a story block, and then works as it does at the house level; a story block cannot be inside a layer block, since a story is not owned by one layer. A constraint takes the layer of the block it is written in; a room and a story are always the designer's.

What a file elaborates to

bim_elab::elaborate produces a bim_model::Program:

  • name: the house's name; jurisdiction: the jurisdiction string, if any.
  • stories, lowest first (source order): id story.<name>, name, and an Origin (layer designer, strength must, span of the whole story block). A house with no story block has the one implied story, StoryDecl::implied(): story.main, with the engine's origin and no span.
  • rooms, in source order: id room.<name>, the id of the story it is on, name, kind, constraints in source order, its cut corners (cuts: corner, leg and an Origin spanning the cut statement, strength must) in source order, and an Origin (layer, strength must, span of the whole room statement).
  • each constraint: property, bound, and an Origin whose span is the constraint.
  • relations, in source order: the two ends' ids (room.<name> or stair.<name>), the kind, the first room's side (side) or cut corner (cut) when written, and an Origin spanning the relation.
  • stairs, in source order: id stair.<name>, name, the ids of the story it rises from and the story it rises to, and an Origin (layer, strength must, span of the stair statement).
  • types: the declared types in source order (id type.<name>, kind, layers with their catalog materials, air films and framing, or a rating; Origin spanning the type statement), then each catalog type a use names, with the engine's origin and its catalog citation.
  • uses: the type uses in source order (target, type id, Origin spanning the statement), then the engine's defaults with Origin::ENGINE.
  • roofs: the roof statements in source order: the story they shape (None for the house), the form, pitch and overhang each if stated, and an Origin spanning the statement. The engine's default is not added; Program::roof_for resolves each roof's values, falling back to it.
  • roof_features: the dormers and gables in source order: the story whose roof they are on (None for the house, meaning the top story), the kind, the side, the count, the place over names, the width if stated, and an Origin spanning the statement. Program::features_for gives a roof's.

With errors, the program still holds everything that elaborated, and is consistent: a room or stair whose declaration has an error is left out, and so is any relation naming one that is left out or unknown. Rooms in a story block whose name has an error are left out. The program always has at least one story.

Errors

Every diagnostic has a stable code, a one-sentence message in domain terms, a primary span, and often related spans and notes (what was expected, a "did you mean", how to fix it). Syntax errors never stop the parse: after an error the parser skips to the next line (a { ... } group in the skipped text is skipped whole), so each bad line costs one diagnostic and the lines after it are still checked. A file with any error is not solved.

Syntax (bim-syntax)

Code When Example
syntax/invalid-character a character with no meaning outside strings and comments # note, ;, >, é in a name
syntax/unterminated-string a string not closed on its line house "Oak {
syntax/invalid-escape a backslash escape other than \", \\ "a\tb"
syntax/missing-unit a number without a unit, or with a space before it width >= 12, width >= 12 ft
syntax/unknown-unit a unit that does not exist 3feet, 40sqf
syntax/invalid-quantity a malformed feet-and-inches value, or a percentage too large to hold 6'-13", 6'-8
syntax/inexact-quantity not a whole number of 100 nm ticks 0.00001mm
syntax/quantity-too-large a length over 10,000 ft or an area over 1,000,000 sq ft 20000ft, 9223372036854775808sqft
syntax/unexpected-token the parser expected something else; the message says what room living living, area: 120sqft, a opens_to b, story 2 { ... }, stair s from main to upper, stair s: main -> upper { width >= 3ft }
syntax/expected-newline a second statement on the same line a door_to b c door_to d
syntax/unclosed-block a { without its }; related span at the {. A story (or house) at the start of a line ends any block still open, so a missing } costs one diagnostic
syntax/misplaced-item a statement outside the house, a nested layer block, jurisdiction in a layer or story block, a strength on a block, a story inside a story or a layer block, a stair inside a story client { designer { } }, prefer story upper { ... }, story main { stair s: main -> upper }
syntax/keyword-as-name a keyword used as a room, story or stair name or a room kind room style: bedroom, story site { ... }

Names and meaning (bim-elab)

Code When Example
elab/missing-house the file has no house an empty file
elab/duplicate-house a second house in one file
elab/duplicate-jurisdiction jurisdiction twice; points at both
elab/reserved-layer (warning) a code or engine block code { ... }
elab/duplicate-room a room with the name of an earlier room or stair; points at both. Names are unique across all stories room bed1: bedroom twice
elab/preferred-room prefer room prefer room office: office
elab/unknown-room-kind a bare kind that is not built in (suggests the closest), or an empty quoted kind room k: kitchn
elab/open-at-corner a corner in open open southeast (write open south east)
elab/open-side-heated open on a heated room room den: living { open south }
elab/door-in-open-side door SIDE on a side the room is open on: no wall there to hold it open south and door south
elab/brief-open open in a layer block's refinement: it is part of the design client { carport { open south } }
elab/door-without-side door OPERATION with no side in a room that is no child room hall: hall { door sliding }
elab/relation-at-corner a corner as a relation's side, where its first room has no cut there (says to write it from the other room when that one is cut there) door_to hall southeast, entry door_to office southwest
elab/operation-without-door an operation on adjacent or open_to, cased among them adjacent hall sliding, open_to hall cased
elab/cased-door cased after door: a cased opening joins two rooms, so it is written as a relation door south cased, closet { door cased }
elab/open-to-unheated a heated room open to an unheated one: open_to between them, or both in one open space; points at the relation, or at the unheated room kitchen open_to porch
elab/door-in-open a door or a cased opening between two rooms of one open space, which have no wall between them open great { room kitchen: kitchen { door_to living } ... }
elab/cars-not-garage cars in a room that is not a garage room bed1: bedroom { cars 1 from south }
elab/cars-count a number of cars below one cars 0
elab/cars-from-corner a corner after from cars 1 from southeast
elab/cars-entry-unknown cars with no from, and not one overhead door on a known side or one open side to drive in through room garage: garage { cars 2 }, room garage: garage { cars 1, door_to drive overhead }
elab/brief-cars cars in a layer block's refinement client { garage { cars 1 } }
elab/cut-at-side a side after cut (names the corners on it) cut south 4ft
elab/invalid-cut a cut that runs back zero cut southwest 0ft
elab/duplicate-cut a second cut at one corner; points at both cut southwest 4ft twice
elab/preferred-cut prefer cut prefer cut southwest 4ft
elab/cut-on-child cut in a child's body closet at northwest { cut southeast 2ft }
elab/brief-cut cut in a layer block's refinement client { office { cut southwest 4ft } }
elab/cut-faces-one-room a second room through one cut corner; points at both door_to entry southwest, adjacent hall southwest
elab/unknown-property a property other than area, width, depth length >= 12ft
elab/unit-mismatch a length for area, an area for width/depth, or a cut's length that is not a length area >= 12ft, width >= 70sqft, cut southwest 4sqft
elab/unknown-room a relation names an undeclared room or stair (suggests the closest) kitchen open_to livng
elab/self-relation a relation from a room or stair to itself bed1 door_to bed1
elab/contradiction a room's "must" constraints cannot all hold; points at each statement involved width >= 14ft, width <= 12ft; area >= 150sqft, width <= 10ft, depth <= 12ft

Types:

Code When Example
elab/duplicate-type two types with one name; points at both type t: wall twice
elab/unknown-type-kind a kind other than wall, floor, roof, ceiling, window, door type t: wal { ... }
elab/unknown-material a layer names a material the catalog lacks (suggests the closest) gypsm_board 0.5in
elab/no-framing-fraction a framed layer at a spacing the catalog has no fraction for, none stated ... between softwood_lumber at 19in
elab/two-framed-layers an assembly with more than one framed layer
elab/empty-type an assembly with no layers type t: wall { }
elab/misplaced-rating, elab/misplaced-layer a rating in an assembly, a layer in a window or door type t: wall { u_factor = 0.3 }
elab/missing-rating, elab/invalid-rating a window or door with no u_factor, or a rating out of range shgc = 1.5
elab/unknown-property a rating other than u_factor (and shgc for windows) type t: door { shgc = 0.3 }
elab/unit-mismatch a thickness or spacing that is not a length, a fraction that is not a percentage gypsum_board 12sqft
elab/unknown-type a use names a type neither declared nor in the catalog (suggests the closest of the right kind) exterior walls: cedr
elab/type-kind-mismatch a use names a type of the wrong kind floors: wood_stud_2x6_r21, roof: attic_r49 (a ceiling)
elab/duplicate-type-use the same target given a type twice; points at both exterior walls: a and exterior walls: b
elab/ambiguous-type-use walls: T without saying which walls: wood_stud_2x4_r13
elab/invalid-type-use a target that takes no type this way bed floors: t
elab/misplaced-type-use a house-wide use in a story block windows: t in story main
elab/stair-type-use ROOM walls or ROOM windows naming a stair
elab/unknown-room a use names an undeclared room, or a wall ROOM OTHER whose other end is neither a room, a stair nor a side wall bed up: t
type/unused (warning, after solving) a stated use gives its type to nothing wall bath living: t when they do not touch
stage/unmapped (after solving) a layer whose role the stage table places in no construction phase for its kind of element a ceiling type with a layer of asphalt_shingles (roofing)

Roofs:

Code When Example
syntax/unexpected-token a roof statement with no words, a word out of order, a pitch not written RISE/RUN, an overhang with no unit roof, roof pitch 6:12, roof pitch 6/12 east, roof overhang 12
elab/unknown-roof-form a form other than hip, gable, shed (suggests the closest; says when a form such as flat or mansard is not modelled yet) roof gabel east
elab/unknown-side a side other than north, east, south, west (suggests the closest) roof gable esat
elab/roof-sides sides after hip; a shed without exactly one side; a side named twice roof hip east, roof shed, roof gable east east
elab/invalid-pitch a pitch of zero (flat), a run of zero, steeper than 24/12, flatter than 1/4 in 12, or finer than three decimal places over 12 (a run over 12000 in lowest terms) roof pitch 0/12, roof pitch 30/12, roof pitch 1/1000, roof pitch 7/1000000000
elab/invalid-overhang an overhang over 4'-0" roof overhang 5ft
elab/unit-mismatch an overhang, or a dormer's or gable's width, that is not a length roof overhang 12sqft, dormer north width 20sqft
elab/duplicate-roof-param pitch or overhang twice in one roof statement (points at both), or width twice on a dormer or gable roof pitch 6/12 pitch 8/12
elab/duplicate-roof two roof statements for the house, or for one story; points at both roof hip and roof gable
roof/no-gable-end (warning, after solving) a gable side with no edge whose two corners are outside corners, on the top story's roof or a story's own roof gable north on an L whose north side steps
roof/no-eave (warning, after solving) a shed's low side has no edge, so it is built as a hip roof roof shed south where nothing faces south
syntax/misplaced-item a dormer or gable in a room's body room den: office { dormer north }
syntax/misplaced-item front in a room's body room a: living { front north }
syntax/unexpected-token a dormer or gable with no side, over with no place, a width with no unit, a stray word dormer, dormer north over, dormer north width 6
elab/misplaced-roof-feature a dormer or gable in a wing or open space wing w { ... dormer north }
elab/dormer-count dormers with a count under two, or not a whole number dormers 1 north
elab/roof-feature-param pitch or overhang on a dormer or gable: it has its roof's dormer north pitch 12/12
elab/invalid-width a width of zero or less dormer north width 0ft
elab/unknown-roof-place over naming no room, wing or open space on the roof's story (suggests the closest) dormer north over bde2
roof/feature-does-not-fit (warning, after solving) a dormer or gable with no slope falling to its side, not on one plane of it, overlapping another, or on a story the story above covers; it is left out dormer east on a roof gabled east

Stories and stairs:

Code When Example
elab/duplicate-story two stories with one name, or names that differ only in case; points at both story upper and story Upper
elab/empty-story a story block with no rooms story loft { }
elab/room-outside-story a room directly in a house that has story blocks (or in a layer block there); related span at the first story room porch: "porch" beside story main { ... }
elab/unknown-story a stair names a story that is not declared (suggests the closest; in a house with no story blocks, says how to add them) stair s: main -> uper
elab/stair-same-story a stair from a story to itself; suggests the story above stair s: main -> main
elab/stair-reversed a stair written from the upper story down; suggests the swapped order stair s: upper -> main
elab/stair-skips-story a stair between stories that are not next to each other; lists the pairs to join instead stair s: main -> attic past upper
elab/missing-stair a story above the lowest that no stair reaches from the story below; points at the story's name and suggests the stair statement to add story upper { ... } with no stair ...: main -> upper
elab/preferred-stair prefer stair prefer stair s: main -> upper
elab/duplicate-stair a stair with the name of an earlier stair or room; points at both stair hall: main -> upper beside room hall: hall
elab/cross-story-relation the two ends of a relation are on different stories, or a room and a stair that does not reach its story; names both stories, related spans at both ends kitchen door_to bed2 with bed2 upstairs
elab/misplaced-relation a relation in a story block whose ends are on another story hall door_to kitchen in story upper
elab/stair-to-stair a relation between two stairs s1 adjacent s2
elab/stair-end-taken two rooms must door_to or open_to one stair on one story, which has one end there; points at the first hall open_to s and living open_to s on main
elab/misplaced-size width or depth directly in a house with stories, or a size in a wing or an open space width ~ 30ft beside story main { ... }
elab/unknown-outline an outline shape other than rectangle (suggests the closest) outline ell
elab/duplicate-outline two outline statements for one story; points at both
elab/misplaced-outline outline directly in a house with stories, or in a wing or an open space
elab/front-at-corner a corner as the house's front front northeast
elab/duplicate-front front written twice; points at both
elab/misplaced-front front in a story, wing or open space story main { front north }
elab/stair-closet-on-turn closet under a stair whose path turns { up north then east, closet }
elab/duplicate-stair-closet closet twice in a stair's body { up north, closet, closet }
elab/misplaced-over over on the lowest story, directly in the house, in a wing or an open space, or on the story over a basement story main { over garage } with main lowest
elab/unknown-over over names something that is not a room, wing or open space of the story directly below (suggests the closest) over garge
elab/duplicate-over over names a place twice over garage, garage
elab/preferred-over prefer over prefer over garage
elab/basement-not-lowest below grade on a story that is not the first listed story main { ... } story lower below grade { ... }
elab/basement-alone below grade on the house's only story
elab/two-basements a second story below grade; points at both
elab/misplaced-basement-statement at grade or under outside a basement's own block (in the house, a story above ground, a wing or an open space) story main { at grade west }
elab/preferred-basement-statement prefer at grade or prefer under prefer under great
elab/duplicate-grade-side a side at grade twice; points at both at grade west written twice
elab/every-side-at-grade all four sides at grade: the story is not below grade at grade north, east, south, west
elab/grade-at-corner a corner in at grade at grade northwest
elab/unknown-under under names nothing of the story above (lists its places) under attic
elab/under-not-a-place under names a stair, a story or a room of the basement itself under stairs
elab/duplicate-under under names a place twice under great, great
elab/door-on-buried-side door SIDE in a basement on a side not at grade (suggests at grade SIDE) door north with at grade west

A stair or story with an error is reported once: a stair that names the wrong stories does not also make its upper story "missing a stair", and an empty story is not also reported as unreachable.

elab/contradiction catches only what needs no solver: crossed bounds on one dimension (including two different =), and an area bound that the width and depth bounds rule out. Conflicts between rooms are the solver's to find and explain.

Code findings (bim-rules, after solving)

A solved house is checked against the code pack (jurisdiction, or the default us/irc-2021). Each rule below is declared once in bim-code and listed, in this order, by bim rules: the table gives its kind, the pack keys it reads and what the solver promises. An enforced rule never fires on a house the solver produced (the compliance test holds it to that); a not enforced rule may, and bim rules says why. Every code finding cites the pack section of the parameter behind it and is advisory while the rule or the parameter is unreviewed (all are today); nothing here says a design passes code. A finding that uses an assumption parameter (window.openable_fraction) names it in a note. A rule whose keys the pack lacks is not run, and a pack/missing-param note says so.

Code Kind Pack keys Solver When (IRC section)
rule/habitable-min-area room bound habitable.min_area enforced a habitable room other than a kitchen has less clear floor area than the minimum (R304.1)
rule/habitable-min-dimension room bound habitable.min_dimension enforced a habitable room other than a kitchen is narrower than the minimum, clear, either way (R304.2)
rule/hall-min-width room bound hall.min_width enforced a hall's narrower clear dimension is under the minimum (R311.6)
rule/ceiling-min-height room bound ceiling.min_height, ceiling.min_height_bath not enforced a story's clear ceiling is under the minimum over its habitable rooms, halls and entries, or under the bathroom minimum over its bathrooms and laundries (R305.1)
rule/stair-riser vertical stair.max_riser enforced a stair's risers are taller than the maximum (R311.7.5.1)
rule/stair-tread vertical stair.min_tread enforced a stair's treads are shallower than the minimum (R311.7.5.2)
rule/stair-width vertical stair.min_width enforced a stair is narrower than the minimum clear width (R311.7.1)
rule/stair-headroom vertical stair.min_headroom not enforced a stair has less headroom above its nosing line than the minimum (R311.7.2)
rule/stair-landing vertical stair.min_landing_depth enforced at a stair's foot or head, no one room beyond the end meets it along the stair's width and runs the landing depth past it, clear of its far wall; the exception for the top of an interior flight is not applied (R311.7.6)
rule/egress-door opening egress_door.min_clear_width, egress_door.min_clear_height enforced the house has no exterior door of the egress size level with the ground at its wall, not into an enclosed court (R311.2)
rule/glazing-min-ratio ratio glazing.min_ratio, porch.light_min_open_share, porch.light_min_ceiling enforced above grade a habitable room's windows in exterior walls, and in walls onto a porch that lights it, total less than the share of its clear floor area (R303.1, R303); below grade the solver does not ask for the window, and the finding says so
rule/ventilation-min-ratio ratio ventilation.min_ratio, window.openable_fraction, porch.light_min_open_share, porch.light_min_ceiling enforced above grade a habitable room's openable window area, taken as the assumed openable share of the windows the glazing rule counts, is less than the share of its clear floor area (R303.1, R303); the note names the assumption
rule/sleeping-room-escape-opening opening egress.min_openings, egress.min_clear_area, egress.min_clear_area_grade_floor, egress.grade_floor_max_sill, egress.min_clear_width, egress.min_clear_height, egress.max_sill enforced a sleeping room (by label or by function) has too few openings meeting the escape opening's area, width, height and sill limits (R310)
rule/basement-escape-opening check-only egress.basement_min_openings, egress.min_clear_area, egress.min_clear_area_grade_floor, egress.grade_floor_max_sill, egress.min_clear_width, egress.min_clear_height, egress.max_sill not enforced a story below grade with a habitable room has fewer openings meeting the escape opening's limits, or exterior doors level with the ground, than the pack asks (R310.1)
rule/sanitation-and-kitchen check-only sanitation.min_bathrooms, kitchen.min_kitchens not enforced the house has fewer bathrooms (each assumed to hold a water closet, a lavatory and a tub or shower) or kitchens than the pack asks for (R306.1, R306.2)
rule/under-stair-protection check-only stair.closet_min_gypsum not enforced a wall round a closet under a stair (closet in its body) has no gypsum board of the pack's thickness on a face (R302.7); the stair's underside and soffits are not modelled, so they are not checked
rule/egress-path topology egress_path.max_garages, egress_door.min_clear_width, egress_door.min_clear_height, carport.min_open_sides not enforced a room cannot reach the egress door, or only through more garages than allowed (R311.1); a carport counts as outdoors (R309.2)
rule/bedroom-through-bedroom topology none not enforced a bedroom is reached only through another (a guideline, a warning)
rule/room-by-function check-only none not enforced an office or other room with its own closet is built like a bedroom (a guideline, a warning)
rule/sleeping-story-without-bath check-only none not enforced a story with a bedroom has no bathroom (a guideline, a warning)
rule/plumbing-not-stacked topology none preferred an upper bathroom is not over or beside a wet room below (a hint, a note)

Design advisories (after solving, from the style pack)

A solved house is also measured for layout quality (bim critique prints the metrics: each room's clear area against the area its program asks for, aspect and exterior wall; each story's and the house's floor area, circulation share and compactness) and checked against a style pack, the built-in style/default (packs/style/default.toml). Its ranges are unreviewed guesses, kind recommendation, citing no code section. The advisories below are warnings with stable design/... codes, reported after the code findings; each names the style pack parameter it used in a note and cites no building code, so it is never a code finding. They are declared in bim-code beside the rules and listed by bim rules after them, in a section of their own; the solver does not read the style pack, so none is enforced. With no style pack the advisories are not checked and a pack/no-style note says so; a style pack without one of the keys skips that advisory with a pack/missing-param note.

Code Kind Pack keys Solver When
design/room-oversized check-only style.room.max_area_ratio not enforced a room's clear area is more than the style pack's multiple of the area its program asks for: its ~ target, else its = value, else its largest >= bound (a room with no area statement is not checked)
design/room-aspect check-only style.room.max_aspect not enforced a habitable room's long clear side is more than the multiple of its short one
design/hall-narrow check-only style.hall.min_width not enforced a hall's narrower clear dimension is under the style pack's comfortable width (the code's minimum is rule/hall-min-width)
design/hall-long check-only style.hall.max_length not enforced a hall's longer clear dimension is over the style pack's length
design/circulation-share check-only style.circulation.max_share not enforced halls, entries, landings and stairs take more than the share of the house's floor area (on wall centrelines, each stair counted on both stories it joins)

Not yet

These are deliberate gaps, because Program cannot hold them yet. Writing them is a syntax error today.

  • Pins: fixing a room's position or size from the lockfile or by hand ("keep the bedroom wing").
  • Variances: a named, reviewed departure from a code requirement.
  • Vertical dimensions: ceiling heights, and the ground's height anywhere but at a story's floor (a sloping site, an area well). Every story has the engine's default ceiling; its height follows from the floor type above it.
  • Split levels, mezzanines and open-to-below spaces such as a two-story foyer, and a foundation for the part of the ground story over no basement (a slab or a crawlspace). A basement is written with below grade (see Basements).
  • Stairs with winders, spirals or more than one landing, an opening in the floor above smaller than the stair, stair constraints on width, and stairs that are not between adjacent stories. A stair is a straight flight, an L or a U, sized by the engine (see Which way a stair runs).
  • A room on two stories, or rooms placed relative to the room below (a bathroom over the kitchen). Which places of the story below a story lies over can be stated (over, see A story's size, shape and place).
  • Outlines other than a rectangle: an L, a T or a U, and the size of a notch.
  • Site: lot lines, setbacks, the buildable envelope, and an orientation off the compass (a house turned 30° from north). Which side faces the street can be stated (front north, see Which way the house faces).
  • Doors, windows and walls as statements (sizes, positions along a wall, hinge side); the engine places them. A door's side and how it opens can be stated (see Doors and cars), and so can their types (see Assemblies and types); their sizes and places along a wall cannot. Pocket, bifold and double doors.
  • More roof shapes: flat roofs, gambrels, mansards, dormers and gables with their own pitch, shed and hipped dormers, a dormer's size and setback, rooms in the attic that a dormer lights, cornice returns, a pitch per side, gables on sides that end at an inside corner, porch roofs (overhangs past 4'-0"), and checks that a lower roof clears the windows above it. Also foundations and ground contact (a slab's heat loss to the ground is not rated), and assemblies with more than one framed layer.
  • Optional rooms (prefer room), counts ("3 bedrooms"), budgets.
  • Reuse: variables, templates, imports, and imperative escape hatches for pieces the vocabulary cannot express.
  • Relative placement ("aligned with the garage's north wall"), non-rectangular rooms other than a corner cut at 45° (see Cut corners): walls at other angles, curved walls, and a cut on a child.
  • Fractional-inch literals such as 6'-8 1/2" (write 6'-8.5").