#include #include COMPILER EBNF CHARACTERS Letter = 'A' .. 'Z' + 'a' .. 'z' . Digit = '0' .. '9' . StringChar = ANY - "\"" . cr = '\r' . lf = '\n' . tab = '\t' . TOKENS Ident = Letter { Letter | Digit } . String = "\"" { StringChar } "\"" . IGNORE cr + lf + tab PRODUCTIONS EBNF = { Production } . Production = (. wchar_t *name; .) Identifier (. coco_string_delete( name ); .) "=" Expression "." . Expression = Term { "|" Term } . Term = Factor { Factor } . Factor = (. wchar_t *name; .) Identifier (. std::wcout << "ident: " << name << std::endl; coco_string_delete( name ); .) | String (. std::wcout << "literal: " << t->val << std::endl; .) | "(" Expression ")" | "[" Expression "]" | "{" Expression "}" . Identifier = Ident (. name = coco_string_create( t->val ); .) . END EBNF.