Skip to content

Commit 7bea39a

Browse files
committed
Add preprocessor directives to the SYNTAX file.
The preprocessor section of the SYNTAX file has been rewritten to match the other sections in style, and include both %include and %define directives. #27
1 parent e99a042 commit 7bea39a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

SYNTAX

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,17 @@ Labels must be specified at the beginning of a line or on their own line.
7878
// 4. PREPROCESSOR ///////////////////////////////
7979
//////////////////////////////////////////////////
8080

81-
TVM has a preprocessor that allows other source files to be included with the directive "%include filename.vm"
81+
TVM's preprocessor works similarly to many C compilers and uses the prefix "%".
8282

83-
During preprocessing, the entire included source file is inserted in place of the %include directive in memory.
83+
// I. Include //
84+
85+
%include filename
86+
Pastes all of the contents of filename into the source code before interpretting it.
87+
88+
// II. Define //
89+
90+
%define identifier value
91+
Define a constant so that all instances of the string "identifier" will be replaced by "value".
8492

8593
//////////////////////////////////////////////////
8694
// 5. INSTRUCTION LISTING ////////////////////////

0 commit comments

Comments
 (0)