* test/strings.hb: new file.
* test/stddef.hb: new file.
* test/errno.hb: new file.
* test/stdio.hb: add more decls.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3827 1b9489fe-b721-0410-924e-b54b9192deb8
* test/test.sh: test integer.cb.
* test/test.sh: test initializer.cb.
* test/test.sh: test test2.cb.
* test/test.sh: test test3.cb.
* test/test.sh: test test4.cb.
* test/test2.cb: long long is not supported now.
* test/test4.cb: f -> main to make compilable.
* test/list-untested.rb: new tool.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3820 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/ast/*Node.java: ditto.
* net/loveruby/cflat/ast/Location.java: new class.
* net/loveruby/cflat/ast/Dumper.java (printClass): show location.
* net/loveruby/cflat/type/*Ref.java: support Location.
* net/loveruby/cflat/parser/Parser.jj: pass location to nodes.
* net/loveruby/cflat/parser/Parser.jj: long long removed.
* net/loveruby/cflat/type/SignedLongLongRef.java: ditto.
* net/loveruby/cflat/type/UnsignedLongLongRef.java: ditto.
* net/loveruby/cflat/type/SignedLongLongType.java: ditto.
* net/loveruby/cflat/type/UnsignedLongLongType.java: ditto.
* net/loveruby/cflat/type/TypeTable.java: ditto.
* net/loveruby/cflat/ast/LiteralNode.java: introduce new superclass of all literal nodes.
* net/loveruby/cflat/ast/StmtNode.java: introduce new superclass of all statement nodes.
* net/loveruby/cflat/ast/Declaration.java: is subclass of Node.
* net/loveruby/cflat/ast/Dumpable.java: removed: Now declarations are subclass of Node.
* net/loveruby/cflat/ast/Dumper.java: follow new class hierarchy.
* net/loveruby/cflat/ast/DefinitionVisitor.java: removed: merge into ASTVisitor again.
* net/loveruby/cflat/compiler/Visitor.java: follow new class hierarchy.
* net/loveruby/cflat/compiler/CodeGenerator.java: ditto.
* net/loveruby/cflat/compiler/TypeResolver.java: ditto.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3800 1b9489fe-b721-0410-924e-b54b9192deb8
* test/pointer4.cb: test derefering AddressNode.
* test/test.sh: run it.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3797 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/TypeChecker.java: do not warn incompatible cast, if it is castable.
* net/loveruby/cflat/type/IntegerType.java (isCastable): allow array.
* net/loveruby/cflat/type/Type.java (isCastable): use isCompatible for default implementation.
* net/loveruby/cflat/type/PointerType.java: forgot to add #isCompatible.
* net/loveruby/cflat/type/PointerType.java: forgot to add #isCastable.
* net/loveruby/cflat/type/PointerType.java (equals): reject type alias by using instanceof.
* net/loveruby/cflat/ast/CastNode.java: forward #isAssignable to base expr.
* test/cast2.cb: test cast of pointer.
* test/Makefile: build it.
* test/test.sh: test it.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3796 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/TypeChecker.java: reject void paramters.
* net/loveruby/cflat/compiler/TypeChecker.java: allow all type of arrays for RHS.
* net/loveruby/cflat/compiler/CodeGenerator.java (variableNode): generate address for allocated array on RHS.
* net/loveruby/cflat/compiler/CodeGenerator.java (ArefNode): expects expr generates pointer by compile().
* net/loveruby/cflat/compiler/CodeGenerator.java (compileLHS/ArefNode): unallocated array is a pointer.
* net/loveruby/cflat/type/Type.java: new method #isPointerAlike.
* net/loveruby/cflat/type/ArrayType.java: implement it.
* net/loveruby/cflat/type/PointerType.java: implement it.
* net/loveruby/cflat/asm/Assembler.java: new method #comment, to add comment.
* test/array-semcheck2.cb: check assignment to unallocated array.
* test/array-semcheck2.cb: check dereference of unallocated array.
* test/Makefile: build it.
* test/test.sh: run it.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3794 1b9489fe-b721-0410-924e-b54b9192deb8
* test/union-semcheck10.cb: test union which contains void.
* test/array-semcheck1.cb: test array which contains void.
* test/test.sh: run them.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3786 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/TypeChecker.java: check lvar initializer.
* net/loveruby/cflat/ast/DefinedVariable.java: new method #setInitializer.
* net/loveruby/cflat/type/PointerType.java (isSameType): all array is same type (allocated arrays are rejected by LHS check).
* test/block.cb: was wrong test.
* test/assign.cb: add tests.
* test/test.sh: adjust output for assign.cb.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3784 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/CodeGenerator.java (AssignNode): should not leave RHS value on stack (because of feature change).
* net/loveruby/cflat/compiler/CodeGenerator.java (VariableNode): load address for array, to support ptr = ary.
* net/loveruby/cflat/compiler/CodeGenerator.java (ArefNode): dereference pointer, to support ptr[0].
* net/loveruby/cflat/compiler/CodeGenerator.java (compileLHS/ArefNode): ditto.
* net/loveruby/cflat/compiler/CodeGenerator.java (compileLHS/ArefNode): support non-LHS expr.
* net/loveruby/cflat/compiler/CodeGenerator.java (compileLHS/ArefNode): support non-constant index.
* net/loveruby/cflat/compiler/CodeGenerator.java (compileLHS/DereferenceNode): support non-LHS expr.
* net/loveruby/cflat/compiler/CodeGenerator.java (compileLHS/PtrMemberNode): support non-LHS expr.
* net/loveruby/cflat/compiler/CodeGenerator.java (PrefixIncNode, PrefixDecNode, SuffixIncNode, SuffixDecNode): support pointer inc/dec.
* net/loveruby/cflat/compiler/CodeGenerator.java: #size -> #allocSize.
* net/loveruby/cflat/type/Type.java: new method #allocSize, to support ptr = ary.
* net/loveruby/cflat/type/ArrayType.java: override #size and #allocSize.
* net/loveruby/cflat/ast/Entity.java: should define #allocSize, not #size.
* net/loveruby/cflat/asm/Register.java: should not handle AMD64 registers.
* net/loveruby/cflat/asm/Assembler.java: should not handle >4 size operators.
* test/pointer-semcheck1.cb: test ptr = ary; ptr[0].
* test/deref-semcheck4.cb: test 1->memb.
* test/deref-semcheck5.cb: test ptr->y where y is not a member.
* test/Makefile: build pointer-semcheck1.
* test/test.sh: run them.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3783 1b9489fe-b721-0410-924e-b54b9192deb8
* test/union-semcheck9.cb: test recursive struct whose member is user type.
* test/struct-semcheck9.cb: test recursive union whose member is user type.
* test/test.sh: run them.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3782 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/TypeChecker.java: reject arguments which has invalid type (struct, union, allocated array).
* net/loveruby/cflat/type/Type.java: new method #isAllocatedArray.
* net/loveruby/cflat/type/ArrayType.java: override it.
* net/loveruby/cflat/type/ArrayType.java: new method #isAllocated.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3779 1b9489fe-b721-0410-924e-b54b9192deb8
* test/ptrmemb.cb: test (*ptr).x where ptr is a pointer to struct.
* test/ptrmemb.cb: test (*ptr).x where ptr is a pointer to union.
* test/ptrtostruct.cb: merged to ptrmemb.cb.
* test/test.sh: remove ptrtostruct.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3778 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/TypeChecker.java: arrays and pointers are both dereferable (== indexable). We can dereference both.
* net/loveruby/cflat/type/Type.java: #isIndexable -> #isDereferable.
* net/loveruby/cflat/type/UserType.java: ditto.
* net/loveruby/cflat/type/ArrayType.java: ditto.
* net/loveruby/cflat/ast/ExprNode.java: ditto.
* net/loveruby/cflat/type/Type.java: #isReferable -> #isDereferable.
* net/loveruby/cflat/type/ArrayType.java: ditto.
* net/loveruby/cflat/type/PointerType.java: ditto.
* net/loveruby/cflat/type/UserType.java: ditto.
* net/loveruby/cflat/ast/ArefNode.java: ptr[0] should be allowed. Use #isDereferable instead of explict pointer check.
* net/loveruby/cflat/ast/DereferenceNode.java: override #type.
* net/loveruby/cflat/ast/ArefNode.java: remove cast for Type.
* net/loveruby/cflat/ast/FuncallNode.java: #functionType should be called after checking isCallable, type check is not needed in #functionType.
* net/loveruby/cflat/ast/PtrMemberNode.java: #baseType -> #dereferedType.
* net/loveruby/cflat/ast/MemberNode.java: reduce cast for Type.
* net/loveruby/cflat/type/Type.java: define #baseType here.
* net/loveruby/cflat/type/ArrayType.java: override #baseType (#base -> #baseType).
* net/loveruby/cflat/type/PointerType.java: ditto.
* net/loveruby/cflat/type/UserType.java: ditto.
* net/loveruby/cflat/ast/Function.java: ditto.
* net/loveruby/cflat/type/PointerType.java: is not an integer. #isInteger removed.
* net/loveruby/cflat/type/ArrayTypeRef.java: #base -> #baseType.
* net/loveruby/cflat/type/PointerTypeRef.java: ditto.
* net/loveruby/cflat/type/TypeTable.java: do not use cast methods, use true cast, since the real type is required here.
* test/usertype.cb: test user type.
* test/Makefile: build it.
* test/test.sh: run it.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3776 1b9489fe-b721-0410-924e-b54b9192deb8