Commit Graph

83 Commits

Author SHA1 Message Date
Minero Aoki b469db1b82 * test: test declaration override (error path).
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4097 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-07 08:08:29 +00:00
Minero Aoki 1524d3d719 * test: test declaration override.
* test/run.sh: new option --help.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4096 1b9489fe-b721-0410-924e-b54b9192deb8
2008-12-07 07:56:00 +00:00
Minero Aoki 234bd96642 * net/loveruby/cflat/compiler/TypeResolver.java: an array on the parameter list is a pointer really.
* net/loveruby/cflat/compiler/TypeChecker.java: an array for stmt value *is* valid because it is a pointer really.
* net/loveruby/cflat/compiler/CodeGenerator.java: st.x while st.x is an array should make a pointer.
* net/loveruby/cflat/type/Type.java: remove #isPointerAlike, there is only a Pointer and an Array already.
* 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: ditto.
* net/loveruby/cflat/ast/Variable.java: ditto.
* net/loveruby/cflat/ast/ExprNode.java: ditto.
* test: check st.x[1] access.
* test: check pst->x[1] access.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4089 1b9489fe-b721-0410-924e-b54b9192deb8
2008-11-16 14:57:11 +00:00
Minero Aoki dd5d3dd4f0 * name code symbols lazily.
* separate Label and Symbol.
* net/loveruby/cflat/compiler/CodeGenerator.java: use Symbol instead of Label for entity symbol.
* net/loveruby/cflat/asm/Symbol.java: new interface.
* net/loveruby/cflat/asm/BaseSymbol.java: new class.
* net/loveruby/cflat/asm/NamedSymbol.java: new class.
* net/loveruby/cflat/asm/SuffixedSymbol.java: new class.
* net/loveruby/cflat/asm/UnnamedSymbol.java: new class.
* net/loveruby/cflat/asm/SymbolTable.java: new class.
* net/loveruby/cflat/asm/*.java: Label -> Symbol.
* net/loveruby/cflat/asm/LabelRef.java: removed.
* net/loveruby/cflat/ast/*.java: Label -> Symbol.
* net/loveruby/cflat/parser/Parser.jj: does not pass a LabelPool anymore.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4072 1b9489fe-b721-0410-924e-b54b9192deb8
2008-10-24 18:40:21 +00:00
Minero Aoki 540c3c7fa3 test aref-semcheck2.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4063 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-27 20:28:31 +00:00
Minero Aoki c39d9fcea5 move tool
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4061 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-27 20:24:42 +00:00
Minero Aoki 47b631eaa7 remove unused, duplicated test
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4059 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-27 20:13:03 +00:00
Minero Aoki 4be975bb5b did not work
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4058 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-27 20:12:46 +00:00
Minero Aoki 69862827dc * implement PIC generation.
* lib/Makefile: should generate PIC for libcbc.o.
* net/loveruby/cflat/compiler/Compiler.java: pass CodeGeneratorOptions to CodeGenerator.
* net/loveruby/cflat/compiler/Options.java: new options -fpic, -fPIC.
* net/loveruby/cflat/compiler/CodeGenerator.java: use position independent address for global variables, common symbols, defined/undefined functions and string constants.
* net/loveruby/cflat/compiler/CodeGeneratorOptions.java: new class.
* net/loveruby/cflat/asm/ELFConstants.java: new interface to define ELF-related constants.
* net/loveruby/cflat/asm/Assembler.java: new method #hidden.
* net/loveruby/cflat/asm/Assembler.java: new overload #section(s,s,s,s,s).
* net/loveruby/cflat/asm/IndirectMemoryReference.java: offset may not long, but Literal.
* net/loveruby/cflat/asm/Literal.java: new method #isZero.
* net/loveruby/cflat/asm/IntegerLiteral.java: ditto.
* net/loveruby/cflat/asm/LabelRef.java: ditto.
* net/loveruby/cflat/ast/ExprNode.java: new method #shouldEvaluatedToAddres.
* net/loveruby/cflat/ast/VariableNode.java: override it.
* net/loveruby/cflat/ast/CastNode.java: override it.
* net/loveruby/cflat/ast/Entity.java: new method #cannotLoad, to implement #shouldEvaluatedToAddress.
* net/loveruby/cflat/ast/Variable.java: override it.
* net/loveruby/cflat/ast/Function.java: override it.
* net/loveruby/cflat/ast/ExprNode.java: rename method: #AsmLiteral -> #AsmValue because it now returns ImmediateValue instead of Literal.
* net/loveruby/cflat/ast/CastNode.java: override it.
* net/loveruby/cflat/ast/LiteralNode.java: rename method also.
* net/loveruby/cflat/ast/IntegerLiteralNode.java: ditto.
* net/loveruby/cflat/ast/StringLiteralNode.java: ditto.
* net/loveruby/cflat/ast/Variable.java: holds memref and address here, not in subclasses.
* net/loveruby/cflat/ast/DefinedVariable.java: ditto.
* net/loveruby/cflat/ast/UndefinedVariable.java: ditto.
* net/loveruby/cflat/ast/LiteralNode.java: new method #memref.
* net/loveruby/cflat/ast/IntegerLiteralNode.java: implement it.
* net/loveruby/cflat/ast/StringLiteralNode.java: implement it.
* net/loveruby/cflat/ast/ConstantEntry.java: holds memref and address.
* net/loveruby/cflat/ast/AST.java: new method #allFunctions, to access undefined functions from code generator.
* net/loveruby/cflat/ast/ToplevelScope.java: ditto.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4057 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-27 20:07:49 +00:00
Minero Aoki ac9c042b57 use ant to compile cbc
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4056 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-27 19:52:23 +00:00
Minero Aoki 7f25d1a693 show test function name while running tests.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4055 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-27 19:52:06 +00:00
Minero Aoki 4f1f681a7c parameterize cbc options.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4049 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-23 13:45:54 +00:00
Minero Aoki 6164216de3 * test/div.cb: test %esi usage.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4044 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-21 16:45:52 +00:00
Minero Aoki 8f3e39031a * net/loveruby/cflat/ast/Function.java: refactoring: new method #label.
* net/loveruby/cflat/compiler/CodeGenerator.java (prologue): omit loop when no-verboseAsm.
* test: check "puts = NULL" and "stdin = NULL" are compilable (of course "puts = NULL" causes segv).


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4043 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-21 09:14:34 +00:00
Minero Aoki 556d917fff * net/loveruby/cflat/compiler/CodeGenerator.java: optimize constant load.
* net/loveruby/cflat/asm/ImmediateValue.java: accept any Literal.
* net/loveruby/cflat/ast/LiteralNode.java: new method #asmLiteral.
* net/loveruby/cflat/ast/CastNode.java: is not constant when cast is effective.
* net/loveruby/cflat/compiler/Compiler.java: new option --verbose-asm.
* net/loveruby/cflat/compiler/Options.java: ditto.
* net/loveruby/cflat/compiler/CodeGenerator.java: ditto.
* net/loveruby/cflat/asm/Assembler.java: new method #indentComment, #unindentComment.
* net/loveruby/cflat/asm/AsmComment.java: indent comments.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4041 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-20 20:43:34 +00:00
Minero Aoki 076d0dea13 * net/loveruby/cflat/compiler/Options.java: new option -O0, -O, -O1, -O2, -Os.
* net/loveruby/cflat/asm/AsmOptimizer.java: new interface to switch optimizer dynamicly.
* net/loveruby/cflat/compiler/PeepholeOptimizer.java -> asm/PeepholeOptimizer.java
* net/loveruby/cflat/compiler/CodeGenerator.java: parameterize AsmOptimizer.
* net/loveruby/cflat/ast/AST.java: holds a typeTable.
* net/loveruby/cflat/compiler/Compiler.java: follow AST change.
* net/loveruby/cflat/compiler/TypeResolver.java: ditto.
* net/loveruby/cflat/compiler/TypeChecker.java: ditto.
* net/loveruby/cflat/compiler/LocalReferenceResolver.java: ditto.
* net/loveruby/cflat/compiler/DereferenceChecker.java: ditto.
* net/loveruby/cflat/compiler/JumpResolver.java: ditto.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4039 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-20 15:13:09 +00:00
Minero Aoki 5c673e2b7d * net/loveruby/cflat/compiler/TypeChecker.java: reject statements whose type is struct/union/allocated array.
* test: test invalid statement expression.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4032 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-15 18:42:46 +00:00
Minero Aoki 47d4b13b1e * net/loveruby/cflat/asm/Literal.java: does not inherit AsmOperand.
* 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
2008-09-15 18:12:46 +00:00
Minero Aoki 9af6bc364f * net/loveruby/cflat/compiler/CodeGenerator.java: both of "puts" and "&puts" should be evaluated to its address.
* net/loveruby/cflat/compiler/CodeGenerator.java: address -> memref.
* net/loveruby/cflat/ast/Entity.java: ditto.
* net/loveruby/cflat/ast/Function.java: ditto.
* net/loveruby/cflat/ast/Variable.java: ditto.
* net/loveruby/cflat/ast/UndefinedVariable.java: ditto.
* net/loveruby/cflat/ast/DefinedVariable.java: ditto.
* net/loveruby/cflat/ast/ExprNode.java: ditto.: ditto.
* net/loveruby/cflat/ast/ArefNode.java: ditto.
* net/loveruby/cflat/ast/MemberNode.java: ditto.
* net/loveruby/cflat/ast/PtrMemberNode.java: ditto.
* net/loveruby/cflat/ast/VariableNode.java: ditto.
* net/loveruby/cflat/ast/CastNode.java: ditto.
* test: test "puts", "&puts", "myputs", "&myputs".


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4025 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-15 17:18:16 +00:00
Minero Aoki ac8256550c add suffix rule for .cb
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4023 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-15 15:53:53 +00:00
Minero Aoki ae0f46cee4 * net/loveruby/cflat/compiler/Compiler.java: link libcbc on making executables.
* Makefile: new file.
* lib/Makefile: new file to build libcbc.a.
* test: test varargs.
* install.sh: new file.
* README: change install.sh usage.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4021 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-15 12:19:11 +00:00
Minero Aoki bdfd802a9c * bin/cbc: follow last directory tree change.
* test/test_cbc.sh: ditto.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4019 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-14 16:25:04 +00:00
Minero Aoki 9a0bfed9f0 * net/loveruby/cflat/compiler/Compiler.java: handle multiple source files.
* 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
2008-09-14 15:51:46 +00:00
Minero Aoki 09f1c83a3b * net/loveruby/cflat/compiler/TypeChecker.java: reject incomplete multi-dimension array for function parameters.
* 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
2008-09-13 17:28:00 +00:00
Minero Aoki ffba97e811 fix typo
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4009 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-13 16:23:11 +00:00
Minero Aoki 3b0a50aaca * net/loveruby/cflat/compiler/CodeGenerator.java (arefNode): calculate element address of multi-dimension array correctly.
* 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
2008-09-13 13:15:38 +00:00
Minero Aoki 5b4def1bd7 * test: test void function without return.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4006 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-13 12:34:51 +00:00
Minero Aoki 633a249559 * net/loveruby/cflat/compiler/CodeGenerator.java: opassign should not spill DX because division uses DX.
* 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
2008-09-06 22:37:39 +00:00
Minero Aoki 355873c1ea * net/loveruby/cflat/parser/Parser.jj: parse sizeof expr.
* 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
2008-09-06 20:10:49 +00:00
Minero Aoki 554e1e9f04 * net/loveruby/cflat/compiler/Compiler.java: use #dumpString.
* net/loveruby/cflat/compiler/Constants.java: new class.
* net/loveruby/cflat/compiler/Constants.java: define constant sourceEncoding.
* net/loveruby/cflat/parser/Parser.jj: get source encoding from Constant class.
* net/loveruby/cflat/ast/Dumper.java: use #dumpString.
* net/loveruby/cflat/asm/Assembler.java: use #dumpString.
* net/loveruby/cflat/utils/TextUtils.java: new method #dumpString, which dumps UTF-8 string correctly.
* test: test UTF-8 string literal.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3997 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-06 17:46:17 +00:00
Minero Aoki cd988128cc * net/loveruby/cflat/compiler/CodeGenerator.java: implement cast.
* net/loveruby/cflat/asm/Assembler.java: new method #movsx, #movzx.
* net/loveruby/cflat/type/PointerType.java: provide #isSigned for cast.
* net/loveruby/cflat/type/ArrayType.java: ditto.
* net/loveruby/cflat/type/UserType.java: ditto.
* test: test cast operation.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3995 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-06 15:59:02 +00:00
Minero Aoki 7d6555c583 * test/test_cbc.sh: run tests for switch stmt.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3991 1b9489fe-b721-0410-924e-b54b9192deb8
2008-08-31 16:54:40 +00:00
Minero Aoki b99c2c277d * net/loveruby/cflat/parser/Parser.jj: pass location node to the CaseNode explicitly.
* 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
2008-08-31 16:49:26 +00:00
Minero Aoki c0b83c8998 * net/loveruby/cflat/compiler/CodeGenerator.java: static function should be local in the file.
* test: test it.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3988 1b9489fe-b721-0410-924e-b54b9192deb8
2008-08-31 16:27:08 +00:00
Minero Aoki f041f5d296 * net/loveruby/cflat/ast/MemberNode.java: has always non-constant address.
* net/loveruby/cflat/asm/AsmEntity.java: remove method #add.
* net/loveruby/cflat/asm/Label.java: ditto.
* net/loveruby/cflat/asm/Reference.java: ditto.
* net/loveruby/cflat/asm/ImmediateValue.java: ditto.
* net/loveruby/cflat/asm/Register.java: ditto.
* net/loveruby/cflat/asm/SimpleAddress.java: ditto.
* net/loveruby/cflat/asm/CompositeAddress.java: ditto.
* test: test nested struct member access.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3982 1b9489fe-b721-0410-924e-b54b9192deb8
2008-08-31 10:59:40 +00:00
Minero Aoki eca722f362 * net/loveruby/cflat/compiler/TypeChecker.java: transform pointer arithmetic to normal arithmetic (e.g. ptr+7 => ptr+(7*sizeof(*ptr))).
* 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
2008-08-31 10:24:40 +00:00
Minero Aoki 0229e05728 * net/loveruby/cflat/ast/Declarations.java: reject duplicated symbols to support duplicated import.
* 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
2008-08-31 06:18:26 +00:00
Minero Aoki fae7f1e085 * net/loveruby/cflat/parser/Parser.jj: implement NULL.
* test: use it.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3977 1b9489fe-b721-0410-924e-b54b9192deb8
2008-08-30 11:21:49 +00:00
Minero Aoki 80651a70cc * net/loveruby/cflat/compiler/TypeChecker.java: ptr==ptr should work.
* net/loveruby/cflat/compiler/TypeChecker.java: ptr&&ptr should work.
* net/loveruby/cflat/compiler/TypeChecker.java: any==any should always returns int.
* net/loveruby/cflat/compiler/CodeGenerator.java: ditto.
* test: test it.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3975 1b9489fe-b721-0410-924e-b54b9192deb8
2008-08-30 11:07:44 +00:00
Minero Aoki 7e39838625 * test/test_cbc.sh: test overrapped lvar.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3974 1b9489fe-b721-0410-924e-b54b9192deb8
2008-08-30 09:01:14 +00:00
Minero Aoki 737fb40fb5 * test/assign.cb: test case was wrong (caused SEGV). I don't know why this test case did not crash.
* test/test_cbc.sh: follow it.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3973 1b9489fe-b721-0410-924e-b54b9192deb8
2008-08-30 08:39:31 +00:00
Minero Aoki 13e2116602 * test/Makefile: testing entry point is run.sh.
* test/shunit.sh: add "shunit_" prefix for all internal functions.
* test/run.sh: load test_*.sh to support multiple test case files.
* test/run.sh: accept command line arguments as test case files.
* test/test.sh -> test/test_cbc.sh
* test/test2.cb -> test/syntax1.cb
* test/test3.cb -> test/syntax2.cb
* test/test4.cb -> test/syntax3.cb


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3968 1b9489fe-b721-0410-924e-b54b9192deb8
2008-08-29 08:05:09 +00:00
Minero Aoki 40720e76cf * net/loveruby/cflat/compiler/CodeGenerator.java: should handle global string literal.
* net/loveruby/cflat/asm/Assembler.java (_long, _quad): should handle label.
* test/run.sh: new test runner.
* test/shunit.sh: library function name must not start with "test_" because they are treated as test case definition.
* test/test.sh: split tests in to multiple functions.
* test/initializer.cb: test string initializer.
* test/comm.cb: ditto.
* test/scomm.cb: ditto.
* test/slvar.cb: ditto.
* test/gvar.cb: ditto.
* test/sgvar.cb: ditto.
* test/slcomm.cb: : ditto.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3967 1b9489fe-b721-0410-924e-b54b9192deb8
2008-08-29 07:35:31 +00:00
Minero Aoki 85f2af8c84 test if empty struct is allowed
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3966 1b9489fe-b721-0410-924e-b54b9192deb8
2008-08-29 05:03:19 +00:00
Minero Aoki a11a16260e * net/loveruby/cflat/compiler/TypeResolver.java: should check duplicated type definition.
* net/loveruby/cflat/type/TypeTable.java: new method #isDefined.
* net/loveruby/cflat/type/TypeTable.java (put): reject duplicated type definition.
* test/recursivetypedef.cb: test duplicated typedef.
* test/test.sh: run it.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3905 1b9489fe-b721-0410-924e-b54b9192deb8
2008-02-11 21:49:42 +00:00
Minero Aoki 0af37dc9cf * net/loveruby/cflat/asm/Reference.java: new constructor Reference(String) for instance.
* net/loveruby/cflat/ast/AST.java: #declarations should include vardecls.
* net/loveruby/cflat/ast/UndefinedVariable.java: #address should return variable symbol.
* net/loveruby/cflat/compiler/LocalReferenceResolver.java: declarations may include variable declaration.
* test/vardecl.cb: test reference of declared external variable.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3884 1b9489fe-b721-0410-924e-b54b9192deb8
2008-02-10 13:33:19 +00:00
Minero Aoki 2bb1639165 * build.xml: new task test.
* build.xml: new task comptest.
* test/Makefile: new task compile.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3835 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 15:30:45 +00:00
Minero Aoki cae2548643 * test/test.sh: should be executable from any directory.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3834 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 15:21:40 +00:00
Minero Aoki d598c2fef9 * test/cbc -> ./cbc
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3832 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 15:13:09 +00:00
Minero Aoki a20c3d4542 * build.xml: new task recompile.
* build.xml: new task jar.
* build.xml: new task clean-build.
* build.xml: new task dist.
* build.properties: remove unused JJT properties.
* test/cbc: use jar file.
* test/Makefile


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3831 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 15:09:51 +00:00