* net/loveruby/cflat/asm/Assembler.java: do not use Literals in instruction operand.
* net/loveruby/cflat/asm/ImmediateValue.java: accept only Literals.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4029 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/Options.java: new class forked from Compiler.java. Command option parser.
* net/loveruby/cflat/compiler/SourceFile.java: new class.
* net/loveruby/cflat/compiler/LdOption.java: new class.
* net/loveruby/cflat/compiler/LdArg.java: new interface.
* net/loveruby/cflat/exception/OptionParseError.java: new error class.
* test: test multiple input.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4016 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/CodeGenerator.java: show stmt line in assembly.
* net/loveruby/cflat/parser/Parser.jj: pass a Token to the Location.
* net/loveruby/cflat/ast/AST.java: use CflatToken.
* net/loveruby/cflat/ast/Location.java: use CflatToken.
* net/loveruby/cflat/ast/CflatToken.java: new file.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4015 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/TypeChecker.java: reject array variable definition without length.
* net/loveruby/cflat/type/Type.java: remove #isAllocated.
* net/loveruby/cflat/type/UserType.java: ditto.
* net/loveruby/cflat/type/ArrayType.java: change #isAllocatedArray semantics. isAllocatedArray requires the all consecutive array types have its length, recursively.
* net/loveruby/cflat/type/ArrayType.java: new method #isIncompleteArray.
* net/loveruby/cflat/compiler/Compiler.java: new option --dump-asm.
* net/loveruby/cflat/compiler/Compiler.java: handle "--" on command line.
* test/run.sh: use bash.
* test/shunit.sh: show program name on core dump.
* test/syntax1.cb: int[][] is now invalid.
* cbci: print coredump and signal.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4010 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/CodeGenerator.java (compileStmt): output statement number and line number as comment.
* net/loveruby/cflat/ast/ArefNode.java: new method #isMultiDimension.
* net/loveruby/cflat/ast/ArefNode.java: new method #baseExpr.
* net/loveruby/cflat/ast/ArefNode.java: new method #elementSize.
* net/loveruby/cflat/ast/ArefNode.java: new method #length.
* net/loveruby/cflat/type/ArrayType.java: add comment.
* test: test multi-dimension array access.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4007 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/ast/PtrMemberNode.java: #dereferedType should return Type instead of ComplexType because DereferenceChecker checks derefered type by this method.
* test: test ptr->memb with complex pointer expression.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4002 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/Visitor.java: support SizeofTypeNode, SizeofExprNode.
* net/loveruby/cflat/compiler/TypeResolver.java: ditto.
* net/loveruby/cflat/compiler/CodeGenerator.java: ditto.
* net/loveruby/cflat/ast/ASTVisitor.java: ditto.
* net/loveruby/cflat/ast/SizeofTypeNode.java: new file.
* net/loveruby/cflat/ast/SizeofExprNode.java: new file.
* net/loveruby/cflat/type/Type.java: default alignment equals to size, not allocSize (e.g. int[4] should be aligned on 4, not 16).
* net/loveruby/cflat/type/StructType.java: element offset calculation was wrong. Elements should be aligned on its own alignment.
* net/loveruby/cflat/type/StructType.java: size calculation was wrong. Struct size is align(last-offset, max-element-alignment).
* net/loveruby/cflat/type/UnionType.java: union's alignment equals to element's max alignment.
* net/loveruby/cflat/type/ComplexType.java: cache computed alignment.
* net/loveruby/cflat/type/ArrayType.java: array's alignment equals to elements' alignment.
* net/loveruby/cflat/ast/Slot.java: new method #allocSize, #alignment.
* net/loveruby/cflat/asm/Assembler.java: new method #align (moved from CodeGenerator).
* test
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3999 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/type/ArrayType.java: should compute allocated size from member's #allocSize, not #size.
* net/loveruby/cflat/type/StructType.java (alignment): do not depend on Entity#size.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3994 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/ast/CaseNode.java: default clause does not have value, we cannot extract location node from values. Receive a location node as a first argument explicitly.
* net/loveruby/cflat/compiler/CodeGenerator.java: must define end label.
* net/loveruby/cflat/compiler/CodeGenerator.java: implement default clause.
* test: test switch stmt.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3990 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/TypeChecker.java: int-ptr is invalid.
* net/loveruby/cflat/compiler/CodeGenerator.java: implement pointer arithmetic correctly (e.g. *(ptr+1) for various types work now).
* net/loveruby/cflat/ast/PrefixOpNode.java: inherit UnaryArithmeticOpNode.
* net/loveruby/cflat/ast/SuffixOpNode.java: ditto.
* net/loveruby/cflat/ast/UnaryArithmeticOpNode.java: new file.
* net/loveruby/cflat/ast/CastNode.java: is not assignable.
* net/loveruby/cflat/type/TypeTable.java: new method #pointerSize, #ptrDiffTypeRef.
* net/loveruby/cflat/type/ArrayType.java: fetch pointer size from a TypeTable.
* net/loveruby/cflat/type/ArrayType.java: we can cast any pointers to void*.
* net/loveruby/cflat/type/PointerType.java: ditto.
* net/loveruby/cflat/type/IntegerTypeRef.java (equals): check name equality by #equals, not ==.
* test: test pointer arithmetic.
* test: CastNode does not becomes LHS, do not check it.
* import/string.hb: add mem* functions.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3979 1b9489fe-b721-0410-924e-b54b9192deb8
* net/loveruby/cflat/compiler/LibraryLoader.java: should return previous loaded symbols for the same import file.
* test: test duplicated import.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3978 1b9489fe-b721-0410-924e-b54b9192deb8