kframework/c-semantics — pull request #7 by liyili2 (2014-05-31 00:47:50+00:00)
Title: Java rewrite engine

Mainly, I change your rule in common/decl/initializer.k as :
```
rule
(next ListItem(te(K:K . F:CId, T:Type))
=> ListItem(te(K . F', T')))
ListItem(te(K:K, t(_, structType(_, _,
fieldInfo(_
ListItem(typedDeclaration(T, F))
ListItem(typedDeclaration(T':Type, F':CId)) _, _, _)
))))
...
when F' =/=K #NoName
[structural]

rule
(next ListItem(te(K:K . F:CId, T:Type))
=> ListItem(te(K . F', T')))
ListItem(te(K:K, t(_, structType(_, _,
fieldInfo(_
ListItem(typedDeclaration(T, F))
ListItem(typedDeclaration(_, #NoName))
ListItem(typedDeclaration(T':Type, F':CId)) _, _, _)
))))
...
[structural]

rule
next (ListItem(te(K:K . F:CId, T:Type)) => .List)
ListItem(te(K:K, t(_, structType(_, _,
fieldInfo(_ ListItem(typedDeclaration(T, F)), _, _)
))))
...
[structural]
rule
next (ListItem(te(K:K . F:CId, T:Type)) => .List)
ListItem(te(K:K, t(_, structType(_, _,
fieldInfo(_
ListItem(typedDeclaration(T, F))
ListItem(typedDeclaration(_, #NoName)), _, _)
))))
...
[structural]
```

to the rule as follow:

```
//define a extra constructor in List to get the
//information of next T' and F' if we have next operator
syntax List ::= searchInFieldInfoList(Type,CId,List,List) [function]
| resultInFieldInfoList(List,List)

rule searchInFieldInfoList(T:Type,F:CId,.List,L:List) => resultInFieldInfoList(.List,L)
rule searchInFieldInfoList(T:Type,F:CId,
ListItem(typedDeclaration(T, F))
ListItem(typedDeclaration(T':Type, F':CId)) L:List,L1:List)
=> resultInFieldInfoList(ListItem(typedDeclaration(T':Type, F':CId)),L1) when F' =/=K #NoName
rule searchInFieldInfoList(T:Type,F:CId,
ListItem(typedDeclaration(T, F))
ListItem(typedDeclaration(_, #NoName))
ListItem(typedDeclaration(T':Type, F':CId)) L:List,L1:List)
=> resultInFieldInfoList(ListItem(typedDeclaration(T':Type, F':CId)),L1)
rule searchInFieldInfoList(T:Type,F:CId,ListItem(typedDeclaration(T, F)),L1:List) => resultInFieldInfoList(.List,L1)
rule searchInFieldInfoList(T:Type,F:CId,ListItem(typedDeclaration(T, F))
ListItem(typedDeclaration(_, #NoName)),L1:List) => resultInFieldInfoList(.List,L1)
rule searchInFieldInfoList(T:Type,F:CId,ListItem(typedDeclaration(T', F')) L:List,L1:List)
=> searchInFieldInfoList(T:Type, F:CId, L:List,L1) when T =/=K T' andBool F =/=K F'

rule
ListItem(next) ListItem(te(K:K . F:CId, T:Type))
ListItem(te(K:K, t(_, structType(_, _,
fieldInfo( (L:List => searchInFieldInfoList(T,F,L,L)), _, _)
))))
...
[structural]

rule
ListItem(next) (ListItem(te(K:K . F:CId, T:Type)) => .List)
ListItem(te(K:K, t(_, structType(_, _,
fieldInfo((resultInFieldInfoList(.List,L:List) => L), _, _)
))))
...
[structural]

rule
(ListItem(next) ListItem(te(K:K . F:CId, T:Type))
=> ListItem(te(K . F', T')))
ListItem(te(K:K, t(_, structType(_, _,
fieldInfo((resultInFieldInfoList(ListItem(typedDeclaration(T':Type, F':CId)),L:List) => L), _, _)
))))
...
[structural]
```