Skip to content

Instantly share code, notes, and snippets.

@NilsHaldenwang
Created October 4, 2010 13:42
Show Gist options
  • Save NilsHaldenwang/609699 to your computer and use it in GitHub Desktop.
Save NilsHaldenwang/609699 to your computer and use it in GitHub Desktop.
entityDef returns [ entity ]
: 'entity' entityName '{' {
entity = Entity.new($entityName.text,
$entityName.start.line)
}
(attrib = attribDef { entity << attrib } )+
'}'
;
entityDef returns [ entity ]
: 'entity' entityName '{' {
entity = Entity.new($entityName.text,
$entityName.start.line)
}
attribDef+
'}'
;
attribDef returns [ attrib ]
: ID ':' TYPE {
attrib = Attribute.new($ID.text,
$TYPE.text.downcase.to_sym,
$ID.line)
}
;
entity User {
first_name: String
last_name: String
age: Integer
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment