Changed grammar and added code generator

* changed the grammar to ease code generation
* added a code generator and a standalone setup to generate SystemC code
using SC-Components lib
This commit is contained in:
2017-09-19 18:08:17 +02:00
parent 2d55eac2b9
commit cc2891cb8c
68 changed files with 20392 additions and 13870 deletions

View File

@ -4,23 +4,19 @@ import org.eclipse.emf.ecore.EObject
import org.eclipse.xtext.ui.editor.hover.html.DefaultEObjectHoverProvider
import com.minres.rdl.rdl.ComponentDefinition
import com.minres.rdl.rdl.ComponentInstance
import com.minres.rdl.rdl.ImmediateInstantiation
import com.minres.rdl.rdl.NamedInstantiation
import com.minres.rdl.rdl.Instantiation
class RDLEObjectHoverProvider extends DefaultEObjectHoverProvider {
override protected String getFirstLine(EObject o) {
switch(o){
ComponentDefinition: return 'Component '+o.name+' of type '+o.type.literal
ComponentInstance: {
val parent = o.eContainer
if (parent instanceof ImmediateInstantiation) {
val compDef = parent.eContainer as ComponentDefinition
return compDef.type.literal+' '+o.name
} else if (parent instanceof NamedInstantiation) {
return parent.component.type.literal+' '+o.name
}
}
}
return super.getFirstLine(o)
}
override protected String getFirstLine(EObject o) {
switch(o){
ComponentDefinition: return 'Component '+o.name+' of type '+o.type.literal
ComponentInstance: {
val parent = o.eContainer
if (parent instanceof Instantiation) {
return (if(parent.componentRef !== null) parent.componentRef.type else parent.component.type).literal.toFirstUpper+' '+o.name
}
}
}
return super.getFirstLine(o)
}
}