diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 8ae44fd9b..28d7c003e 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -2441,11 +2441,14 @@ public: class AstModule : public AstNodeModule { // A module declaration +private: + bool m_isProgram; // Module represents a program public: - AstModule(FileLine* fl, const string& name) - : ASTGEN_SUPER(fl, name) {} + AstModule(FileLine* fl, const string& name, bool program = false) + : ASTGEN_SUPER(fl, name) + , m_isProgram(program) {} ASTNODE_NODE_FUNCS(Module) - virtual string verilogKwd() const { return "module"; } + virtual string verilogKwd() const { return m_isProgram ? "program" : "module"; } }; class AstNotFoundModule : public AstNodeModule { diff --git a/src/verilog.y b/src/verilog.y index 2e804a72f..b8d9f2cb8 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -1465,7 +1465,7 @@ program_declaration: // IEEE: program_declaration + program_nonansi_header + pr pgmFront: yPROGRAM lifetimeE idAny/*new_program*/ - { $$ = new AstModule($3,*$3); + { $$ = new AstModule($3, *$3, true); $$->lifetime($2); $$->inLibrary(PARSEP->inLibrary() || $$->fileline()->celldefineOn()); $$->modTrace(GRAMMARP->allTracingOn($$->fileline()));