-
Notifications
You must be signed in to change notification settings - Fork 0
LMC Style Guide
Matthew Joyce edited this page Jan 1, 2016
·
4 revisions
This guide outlines the style that should be used for all examples which are part of the specter project. Files can be checked for conformance by lmcstyle.py.
- File must end with only one newline
- Comments begin with
# - Good -
INP # Get input - Bad -
INP #Get input - No trailing whitespace except newline
- Good -
INP - Bad -
INP
- The label must be padded to eight spaces, even when not present
- Good -
START INP - Bad -
START INP - Bad -
START INP - The mnemonic must be padded to four spaces
- Good -
START LDA ONE - Bad -
START LDA ONE - The argument must be padded to eight spaces
- If the argument is not present, eight spaces are only necessary when there is a comment
- Good -
START LDA ONE - Good -
START LDA ONE # Begin loop - Bad -
START LDA ONE - Bad -
START LDA ONE # Begin loop - Use spaces for padding, not tabs
- Padding must follow the arg / mnemonic / label
- Good -
START INP - Bad -
START INP
-
The line does not have any preceding whitespace, except when it is to continue on from a comment on a line with an instruction
-
Good -
INP # Start of loop # Load user input first -
Bad -
INP # Start of loop # Load user input first -
Bad -
# Program by Bob Smith