Commit Graph

406 Commits

Author SHA1 Message Date
Minero Aoki 5e8902cc51 * net/loveruby/cflat/compiler/JumpResolver.java (currentBreakTarget, currentContinueTarget): does not throw exception.
* net/loveruby/cflat/compiler/JumpResolver.java: add preproc tags.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3871 1b9489fe-b721-0410-924e-b54b9192deb8
2008-02-07 19:46:21 +00:00
Minero Aoki cd77f10e64 * build.xml: unify task: jar and compile.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3866 1b9489fe-b721-0410-924e-b54b9192deb8
2008-02-03 09:37:24 +00:00
Minero Aoki eb82686b82 * net/loveruby/cflat/parser/Parser.jj: refactoring: extract method: new method addKnownTypedefs.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3865 1b9489fe-b721-0410-924e-b54b9192deb8
2008-02-03 09:36:56 +00:00
Minero Aoki f50dfa8add * net/loveruby/cflat/compiler/Compiler.java (dumpTokenList): specialToken handling was wrong. We should trace t.specialToken while it becomes null, then follow t.next.
* net/loveruby/cflat/parser/Parser.jj: write token name for special tokens.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3864 1b9489fe-b721-0410-924e-b54b9192deb8
2008-02-03 09:30:23 +00:00
Minero Aoki 4bee7c8246 add preproc tags.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3859 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-20 22:07:45 +00:00
Minero Aoki c118dd43ae updated
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3858 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-20 20:47:35 +00:00
Minero Aoki 63af21eaf4 * net/loveruby/cflat/compiler/Compiler.java: new command line option -v (show arguments of external command invocation).
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3857 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-20 20:38:06 +00:00
Minero Aoki d04a86cce8 * net/loveruby/cflat/compiler/Compiler.java: new command line option -S (generate assembly source and quit).
* net/loveruby/cflat/compiler/Compiler.java: new command line option -c (assemble and quit).
* net/loveruby/cflat/compiler/Compiler.java: call GNU as and GNU ld directly, instead of gcc.
* net/loveruby/cflat/compiler/Compiler.java (commandMain): refactoring: extract method: parseOptions.
* net/loveruby/cflat/compiler/Compiler.java: refactoring: introduce new class Options and hold all command options in it.
* net/loveruby/cflat/compiler/Compiler.java: refactoring: #compileFile do all tasks by referencing an Options.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3856 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-20 20:28:53 +00:00
Minero Aoki 564d0fe2d1 * net/loveruby/cflat/compiler/LibraryLoader.java: should reject recursive import.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3855 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-20 20:24:58 +00:00
Minero Aoki bde2429d8d * net/loveruby/cflat/parser/Parser.jj: produce Error for UnknownEncodingError. Current Java runtime must know UTF-8 encoding.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3854 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-20 17:51:06 +00:00
Minero Aoki 067629484c * net/loveruby/cflat/parser/Parser.jj: refactoring: reorder member decl.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3853 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-20 16:58:59 +00:00
Minero Aoki 4a50b276ba * net/loveruby/cflat/parser/Parser.jj: modify preproc tag.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3852 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-20 16:39:26 +00:00
Minero Aoki d2e6a12902 * net/loveruby/cflat/parser/Parser.jj: change symbol name to fix compile error.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3851 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-20 16:24:25 +00:00
Minero Aoki 13a10588e7 * net/loveruby/cflat/parser/Parser.jj: refactoring: rename rule: defvars -> defvar.
* net/loveruby/cflat/parser/Parser.jj: refactoring: extract new symbol defvar_list from block.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3850 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-20 16:22:10 +00:00
Minero Aoki 5c5e0c8781 * net/loveruby/cflat/ast/Declarations.java: refactoring: new method #addDefvars.
* net/loveruby/cflat/parser/Parser.jj: use it.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3849 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-20 16:19:13 +00:00
Minero Aoki 2d2dac92e5 * net/loveruby/cflat/ast/Parameter.java: simplify dump output.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3848 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-20 15:42:54 +00:00
Minero Aoki 73b8a0e940 add ToDo
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3847 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-20 12:27:41 +00:00
Minero Aoki 9acd26377c * net/loveruby/cflat/parser/Parser.jj: refactoring: rename lvar.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3846 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-18 22:22:32 +00:00
Minero Aoki 339365c677 * net/loveruby/cflat/parser/Parser.jj: should generate special token for block comment, instead of just skipping.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3845 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 17:34:02 +00:00
Minero Aoki 7760b11d55 * net/loveruby/cflat/parser/Parser.jj: LOOKAHEAD is useless here.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3844 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 17:31:17 +00:00
Minero Aoki d734cfc26a add ReVIEW preproc tags
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3843 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 16:31:18 +00:00
Minero Aoki 501c989b39 local property file removed; use $HOME/.ant-global.properties instead.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3842 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 16:06:25 +00:00
Minero Aoki efa91bbf9f * build.xml: read user defined property file from $HOME.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3841 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 16:05:00 +00:00
Minero Aoki aaa75d0e75 * build.xml: now default task is "jar" instead of "compile".
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3840 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 15:51:43 +00:00
Minero Aoki ad7f9d35f2 * build.xml (recompile): build jar file.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3839 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 15:48:49 +00:00
Minero Aoki af3c0eb120 add build.jar property
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3838 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 15:40:34 +00:00
Minero Aoki 98e1ceb016 do not use parameters in property file (it causes error on Mac OS X ant (version 1.7)
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3837 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 15:40:18 +00:00
Minero Aoki c3370a1ddb adjust properties for latest build.xml
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3836 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 15:36:38 +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 dd1b1dbd05 * cbc: $basedir should be relative to cbc command.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3833 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 15:16:24 +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
Minero Aoki 935a4d0ab2 load path done
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3830 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 12:50:24 +00:00
Minero Aoki cf37e6ae72 * test/cbc: provide -I option to add load path.
* net/loveruby/cflat/compiler/Compiler.java: new option -I.
* net/loveruby/cflat/parser/Parser.jj: allow nested library ID "a.b.c".
* net/loveruby/cflat/compiler/LibraryLoader.java: ditto.
* import/unistd.hb: declare fork, getpid, getppid.
* import/sys/types.hb: new file.
* test/fork.cb: test nested library ID "sys.types".


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3829 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 12:49:03 +00:00
Minero Aoki 1b544d25f6 * move *.hb files from test/ to import/.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3828 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-14 12:23:38 +00:00
Minero Aoki 173fedc9ef * test/string.hb: new file.
* 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
2008-01-14 12:22:33 +00:00
Minero Aoki 2c3c2d2db7 * net/loveruby/cflat/ast/DefinedFunction.java: remove unused method #isFunction.
* net/loveruby/cflat/ast/UndefinedFunction.java: ditto.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3826 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-13 17:40:39 +00:00
Minero Aoki 0a0e766158 * net/loveruby/cflat/parser/Parser.jj: unify IntegerLiteralNode and CharacterLiteralNode.
* net/loveruby/cflat/compiler/Visitor.java: ditto.
* net/loveruby/cflat/compiler/CodeGenerator.java: ditto.
* net/loveruby/cflat/compiler/TypeResolver.java: ditto.
* net/loveruby/cflat/ast/ASTVisitor.java: ditto.
* net/loveruby/cflat/ast/CharacterLiteralNode.java: removed.
* net/loveruby/cflat/ast/IntegerLiteralNode.java: show typeNode member.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3825 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-13 17:21:25 +00:00
Minero Aoki bb539ff306 add preproc tag
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3824 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-13 15:45:29 +00:00
Minero Aoki 828bba1d9e * net/loveruby/cflat/compiler/Compiler.java (parseFile): report errors if it is not a syntax error.
* net/loveruby/cflat/parser/Parser.jj: declare SyntaxException and FileException separately.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3823 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-12 23:13:48 +00:00
Minero Aoki b640304ccf * net/loveruby/cflat/compiler/Compiler.java: new option --debug-parser.
* net/loveruby/cflat/parser/Parser.jj: dump parsing process using JavaCC's tracing function.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3822 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-12 22:54:07 +00:00
Minero Aoki 13bee146e1 * net/loveruby/cflat/compiler/DereferenceChecker.java: throw SemanticError on invalid expr and catch it on each statement.
* test/test3.cb: make compilable.
* test/aref-semcheck2.cb: test nested invalid expr.
* test/test.sh: run aref-semcheck2.cb.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3821 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-12 21:53:46 +00:00
Minero Aoki d77ee40092 * net/loveruby/cflat/type/ArrayType.java (size): returns pointer size if the type is not allocated.
* 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
2008-01-12 20:21:11 +00:00
Minero Aoki fd5caed6fc * net/loveruby/cflat/compiler/TypeChecker.java: fork DereferenceChecker, to reduce catch(SemanticError).
* net/loveruby/cflat/compiler/DereferenceChecker.java: new class.
* net/loveruby/cflat/ast/ExprNode.java (isAssignable, isDereferable): catch SemanticError which may occuer on type.isXXXX.
* net/loveruby/cflat/compiler/Visitor.java: refactoring: rename method: #resolve -> #visitNode.
* net/loveruby/cflat/compiler/Visitor.java: refactoring: rename method: #resolveNodeList -> #visitNodeList.
* net/loveruby/cflat/compiler/JumpResolver.java: ditto.
* net/loveruby/cflat/compiler/LocalReferenceResolver.java: ditto.
* net/loveruby/cflat/compiler/TypeResolver.java: ditto.
* net/loveruby/cflat/compiler/TypeChecker.java: ditto.
* net/loveruby/cflat/compiler/Compiler.java: parse command line options more precisely.
* net/loveruby/cflat/compiler/Compiler.java: new option --compile.
* net/loveruby/cflat/compiler/Compiler.java: new option --dump-reference.
* net/loveruby/cflat/compiler/Compiler.java: new option --dump-semantic.
* net/loveruby/cflat/ast/VariableNode.java (dump): show resolved or not.
* net/loveruby/cflat/ast/TypeNode.java (dump): ditto.
* net/loveruby/cflat/ast/Dumper.java (printMember): ditto.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3819 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-12 19:48:31 +00:00
Minero Aoki a88b9a2bca * net/loveruby/cflat/type/Type.java: make #isCompatible and #isCastable abstract.
* net/loveruby/cflat/type/VoidType.java: define #equals, #isSameType, #isCompatible, #isCastableTo.
* net/loveruby/cflat/type/ComplexType.java: define #isSameType, #isCompatible, #isCastableTo, #memberTypes.
* net/loveruby/cflat/type/ArrayType.java: define #isCompatible, #isCastableTo.
* net/loveruby/cflat/type/PointerType.java (isCompatible): void pointer is compatible with any pointer.
* net/loveruby/cflat/type/FunctionType.java: check parameter types.
* net/loveruby/cflat/ast/Params.java: define #types and #isSameType to be used from FunctionType.
* net/loveruby/cflat/ast/FixedParams.java: ditto.
* net/loveruby/cflat/ast/VarParams.java: ditto.
* net/loveruby/cflat/type/TypeTable.java: new method #voidType.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3818 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-12 19:47:28 +00:00
Minero Aoki 3c73577871 forgot to check in
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3817 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-12 19:34:57 +00:00
Minero Aoki 89667f89fa * test/unistd.hb: define _exit.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3816 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-12 19:34:34 +00:00
Minero Aoki 2416f943ee forgot to check in
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3815 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-06 22:47:03 +00:00
Minero Aoki ab9b6482c0 * net/loveruby/cflat/parser/Parser.jj: refactoring: rename method: #loc -> #location.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3814 1b9489fe-b721-0410-924e-b54b9192deb8
2008-01-06 22:08:49 +00:00