Closed enjoysmath closed 3 years ago
enum EXEGrammar = ` EXE: ASMFile < Header Header < Format EntryPoint Includes Format < "format PE console"i EntryPoint < "entry"i Label Includes < Include* Include < "include"i "'" FileName "'" FileName < identifier Label < identifier `;
Here's what I'm passing the grammar to parse tree function (EXE):
format PE console entry start include 'includes/win32a.inc' include 'myinclude.inc'
And here's the parse tree printed:
Enter a .asm file name: prog9.asm prog9.asm EXE[0, 34]["format PE console", "entry", "start"] +-EXE.ASMFile[0, 34]["format PE console", "entry", "start"] +-EXE.Header[0, 34]["format PE console", "entry", "start"] +-EXE.Format[0, 19]["format PE console"] +-EXE.EntryPoint[19, 34]["entry", "start"] +-EXE.Label[25, 34]["start"]
As you can see, it skips the include lines... What am I doing incorrectly in the grammar?
Figured it out. It's because 'includes/my_include.inc' is not a C identifier!
So passing in this (test) example works:
format PE console entry start include 'includeswin32ainc' include 'myincludeinc'
Here's what I'm passing the grammar to parse tree function (EXE):
And here's the parse tree printed:
As you can see, it skips the include lines... What am I doing incorrectly in the grammar?