{"action":"created","issue":{"url":"https://api.github.com/repos/rsmmr/hilti/issues/3","labels_url":"https://api.github.com/repos/rsmmr/hilti/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/rsmmr/hilti/issues/3/comments","events_url":"https://api.github.com/repos/rsmmr/hilti/issues/3/events","html_url":"https://github.com/rsmmr/hilti/issues/3","id":91284863,"number":3,"title":"Grammars with \"&convert=SomeEnum($$)\" do not compile with hilti-build and pac-driver","user":{"login":"blipp","id":138279,"avatar_url":"https://avatars.githubusercontent.com/u/138279?v=3","gravatar_id":"","url":"https://api.github.com/users/blipp","html_url":"https://github.com/blipp","followers_url":"https://api.github.com/users/blipp/followers","following_url":"https://api.github.com/users/blipp/following{/other_user}","gists_url":"https://api.github.com/users/blipp/gists{/gist_id}","starred_url":"https://api.github.com/users/blipp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blipp/subscriptions","organizations_url":"https://api.github.com/users/blipp/orgs","repos_url":"https://api.github.com/users/blipp/repos","events_url":"https://api.github.com/users/blipp/events{/privacy}","received_events_url":"https://api.github.com/users/blipp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-26T15:50:04Z","updated_at":"2015-07-09T14:08:17Z","closed_at":null,"body":"If I try to compile the following minimal grammar with\r\n<code>hilti-build -o a.out tools/pac-driver/pac-driver.cc libbinpac/parsers/minimal.pac2</code>, and get an error message from hiltic, see below. If I do not use <code>convert</code> but the line without it (see code), the compilation terminates successfully. Additionally, when running the grammar with <code>pac-driver</code>'s JIT, there is no problem with <code>convert</code>.\r\n\r\nMinimal grammar:\r\n\r\n```\r\nmodule Profinet;\r\n\r\nimport BinPAC;\r\n\r\ntype EtherType = enum {\r\n  IPV4 = 0x800,\r\n  ARP = 0x806,\r\n  Wake_on_LAN = 0x842\r\n};\r\n\r\nexport type EthernetPacket = unit {\r\n  destination: bytes &length=6;\r\n  source: bytes &length=6;\r\n  ethertype: uint<16> &convert=EtherType($$);\r\n#  ethertype: uint<16>;\r\n  payload: bytes &eod;\r\n\r\n  on %done {\r\n    print self.ethertype;\r\n  }\r\n};\r\n```\r\n\r\nError message:\r\n\r\n```\r\n>>> Undef\r\nprofinet.hb3547.tmp.hlt:714-714: error, unknown ID Undef [pass::hilti::IdResolver]\r\nprofinet.hb3547.tmp.hlt: Aborting due to verification error.\r\nerror running hiltic, aborting\r\n```\r\n\r\nPart of <code>profinet.hb3547.tmp.hlt</code>:\r\n\r\n```\r\n  @if_true_23\r\n    struct.set __self \"ethertype\" Undef\r\n    jump @if_cont_23\r\n```\r\n\r\nI tried the included grammars <code>pcap.pac2</code> and <code>tftp.pac2</code>, they have the same problem with <code>hilti-build</code>, but not with <code>pac-driver</code>."},"comment":{"url":"https://api.github.com/repos/rsmmr/hilti/issues/comments/119992513","html_url":"https://github.com/rsmmr/hilti/issues/3#issuecomment-119992513","issue_url":"https://api.github.com/repos/rsmmr/hilti/issues/3","id":119992513,"user":{"login":"blipp","id":138279,"avatar_url":"https://avatars.githubusercontent.com/u/138279?v=3","gravatar_id":"","url":"https://api.github.com/users/blipp","html_url":"https://github.com/blipp","followers_url":"https://api.github.com/users/blipp/followers","following_url":"https://api.github.com/users/blipp/following{/other_user}","gists_url":"https://api.github.com/users/blipp/gists{/gist_id}","starred_url":"https://api.github.com/users/blipp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blipp/subscriptions","organizations_url":"https://api.github.com/users/blipp/orgs","repos_url":"https://api.github.com/users/blipp/repos","events_url":"https://api.github.com/users/blipp/events{/privacy}","received_events_url":"https://api.github.com/users/blipp/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T14:08:17Z","updated_at":"2015-07-09T14:08:17Z","body":"Thanks for the explanation. I'll stick with pac-driver for the moment then. I'll comment back here if this issue becomes more important for my project to ask how this can be fixed."}}