Overview
SHA1 Hash: | 2bdfb8a182d6e12c1e30fe82c474b3159ab2541a |
---|---|
Date: | 2010-11-21 20:11:49 |
User: | kinaba |
Comment: | moved build sciprt for documents into Poseidon environment |
Timelines: | family | ancestors | descendants | both | trunk |
Downloads: | Tarball | ZIP archive |
Other Links: | files | file ages | manifest |
Tags And Properties
- branch=trunk inherited from [f65680e1d2]
- sym-trunk inherited from [f65680e1d2]
Changes
Modified .poseidon from [689f2a54d91081ce] to [07d04070d657a1fa].
7 <filter>*.d</filter> 7 <filter>*.d</filter> 8 <showemptyfolder>0</showemptyfolder> 8 <showemptyfolder>0</showemptyfolder> 9 <buildSpec> 9 <buildSpec> 10 <buildType>0</buildType> 10 <buildType>0</buildType> 11 <mainFile>main.d</mainFile> 11 <mainFile>main.d</mainFile> 12 <Args /> 12 <Args /> 13 <options> 13 <options> 14 <dmd> -g -unittest </dmd> | 14 <dmd> -cov -D -Dddoc -g -unittest </dmd> 15 <tool /> 15 <tool /> 16 <lib /> 16 <lib /> 17 <implib /> 17 <implib /> 18 <extra /> 18 <extra /> 19 <toolextra /> 19 <toolextra /> 20 <merge>0</merge> 20 <merge>0</merge> 21 <nonfiles>0</nonfiles> 21 <nonfiles>0</nonfiles> ................................................................................................................................................................................ 26 <dmdpath /> 26 <dmdpath /> 27 <dmcpath /> 27 <dmcpath /> 28 <buildtoolexe /> 28 <buildtoolexe /> 29 <projectFiles> 29 <projectFiles> 30 <source> 30 <source> 31 <name>d2stacktrace\dbghelp.d</name> 31 <name>d2stacktrace\dbghelp.d</name> 32 <name>d2stacktrace\stacktrace.d</name> 32 <name>d2stacktrace\stacktrace.d</name> > 33 <name>doc\candydoc\candy.ddoc</name> > 34 <name>doc\candydoc\modules.ddoc</name> 33 <name>main.d</name> 35 <name>main.d</name> 34 <name>polemy\_common.d</name> 36 <name>polemy\_common.d</name> 35 <name>polemy\ast.d</name> 37 <name>polemy\ast.d</name> 36 <name>polemy\eval.d</name> 38 <name>polemy\eval.d</name> 37 <name>polemy\failure.d</name> 39 <name>polemy\failure.d</name> 38 <name>polemy\layer.d</name> 40 <name>polemy\layer.d</name> 39 <name>polemy\lex.d</name> 41 <name>polemy\lex.d</name> ................................................................................................................................................................................ 44 </source> 46 </source> 45 <interface /> 47 <interface /> 46 <resource /> 48 <resource /> 47 <othersDMD /> 49 <othersDMD /> 48 <others> 50 <others> 49 <name>build.bat</name> 51 <name>build.bat</name> 50 <name>build.sh</name> 52 <name>build.sh</name> 51 <name>builddoc.bat</name> < 52 <name>readme.txt</name> 53 <name>readme.txt</name> 53 </others> 54 </others> 54 </projectFiles> 55 </projectFiles> 55 <includePaths /> 56 <includePaths /> 56 <linkLibrarys /> 57 <linkLibrarys /> 57 <importExpressions /> 58 <importExpressions /> 58 </buildSpec> 59 </buildSpec> 59 </projectDescription> 60 </projectDescription>
Deleted builddoc.bat version [7f7c5c8755679d44]
1 @setlocal ENABLEDELAYEDEXPANSION < 2 @set ARGS= < 3 @for %%I in (main.d polemy\*.d tricks\*.d) do @set ARGS=!ARGS! %%I < 4 @if not exist bin mkdir bin < 5 @echo dmd -o- -Dddoc doc\candydoc\candy.ddoc doc\candydoc\modules.ddoc %ARGS% < 6 @dmd -o- -Dddoc doc\candydoc\candy.ddoc doc\candydoc\modules.ddoc %ARGS% <
Modified polemy/ast.d from [351d6a36d1e1b0e0] to [02291a629f0b15b6].
7 module polemy.ast; 7 module polemy.ast; 8 import polemy._common; 8 import polemy._common; 9 import polemy.failure; 9 import polemy.failure; 10 10 11 /// 11 /// 12 abstract class AST 12 abstract class AST 13 { 13 { 14 immutable LexPosition pos; | 14 LexPosition pos; 15 mixin SimpleConstructor; 15 mixin SimpleConstructor; 16 mixin SimplePatternMatch; 16 mixin SimplePatternMatch; 17 } 17 } 18 18 19 /// 19 /// 20 class StrLiteral : AST 20 class StrLiteral : AST 21 { 21 {
Modified polemy/failure.d from [ceae1b272549ae1a] to [594acaf3ac60594c].
5 * Error Information for Polemy Programming Language 5 * Error Information for Polemy Programming Language 6 */ 6 */ 7 module polemy.failure; 7 module polemy.failure; 8 import polemy._common; 8 import polemy._common; 9 9 10 /// Represents a position in source codes 10 /// Represents a position in source codes 11 11 12 class LexPosition | 12 class LexPosition_t 13 { 13 { 14 immutable string filename; /// name of the source file 14 immutable string filename; /// name of the source file 15 immutable int lineno; /// 1-origin 15 immutable int lineno; /// 1-origin 16 immutable int column; /// 1-origin 16 immutable int column; /// 1-origin 17 17 18 mixin SimpleClass; 18 mixin SimpleClass; 19 override string toString() const 19 override string toString() const 20 { 20 { 21 return sprintf!("%s:%d:%d")(filename, lineno, column); 21 return sprintf!("%s:%d:%d")(filename, lineno, column); 22 } 22 } 23 23 24 static immutable LexPosition dummy; | 24 static LexPosition dummy; 25 static this(){ dummy = new immutable(LexPosition)("<unnamed>",0,0); } | 25 static this(){ dummy = new LexPosition("<unnamed>",0,0); } 26 } 26 } 27 27 > 28 /// Represents a position in source codes > 29 > 30 alias immutable(LexPosition_t) LexPosition; > 31 28 unittest 32 unittest 29 { 33 { 30 auto p = new LexPosition("hello.cpp", 123, 45); 34 auto p = new LexPosition("hello.cpp", 123, 45); 31 35 32 assert_eq( p.filename, "hello.cpp" ); 36 assert_eq( p.filename, "hello.cpp" ); 33 assert_eq( p.lineno, 123 ); 37 assert_eq( p.lineno, 123 ); 34 assert_eq( p.column, 45 ); 38 assert_eq( p.column, 45 ); ................................................................................................................................................................................ 43 assert_lt( p, q ); 47 assert_lt( p, q ); 44 assert_ne( p, q ); 48 assert_ne( p, q ); 45 } 49 } 46 50 47 /*mixin*/ 51 /*mixin*/ 48 template ExceptionWithPosition() 52 template ExceptionWithPosition() 49 { 53 { 50 const LexPosition pos; | 54 LexPosition pos; 51 this( const LexPosition pos, string msg, string file=null, size_t line=0 | 55 this( LexPosition pos, string msg, string file=null, size_t line=0, Thro 52 { 56 { 53 if(pos is null) 57 if(pos is null) 54 super(sprintf!("[???????] %s")(msg), file, line, next); | 58 super(sprintf!("[??] %s")(msg), file, line, next); 55 else 59 else 56 super(sprintf!("[%s] %s")(pos, msg), file, line, next); 60 super(sprintf!("[%s] %s")(pos, msg), file, line, next); 57 this.pos = pos; 61 this.pos = pos; 58 } 62 } 59 } 63 } 60 64 61 class UnexpectedEOF : Exception { mixin ExceptionWithPosition; } /// EOF during 65 class UnexpectedEOF : Exception { mixin ExceptionWithPosition; } /// EOF during 62 class LexException : Exception { mixin ExceptionWithPosition; } /// Lexer errors 66 class LexException : Exception { mixin ExceptionWithPosition; } /// Lexer errors 63 class ParseException : Exception { mixin ExceptionWithPosition; } /// Parser err 67 class ParseException : Exception { mixin ExceptionWithPosition; } /// Parser err 64 class RuntimeException : Exception { mixin ExceptionWithPosition; } /// Evaluato 68 class RuntimeException : Exception { mixin ExceptionWithPosition; } /// Evaluato
Modified polemy/lex.d from [480bb741b8b1612b] to [165f2920b68bc5f6].
19 immutable bool quoted; /// Was it a "quoted" token or unquoted? 19 immutable bool quoted; /// Was it a "quoted" token or unquoted? 20 20 21 mixin SimpleClass; 21 mixin SimpleClass; 22 } 22 } 23 23 24 unittest 24 unittest 25 { 25 { 26 auto p = new immutable(LexPosition)("hello.cpp", 123, 45); | 26 auto p = new LexPosition("hello.cpp", 123, 45); 27 auto t = new Token(p, "class", false); 27 auto t = new Token(p, "class", false); 28 auto u = new Token(p, "class", true); 28 auto u = new Token(p, "class", true); 29 29 30 assert_eq( t.pos, p ); 30 assert_eq( t.pos, p ); 31 assert_eq( t.str, "class" ); 31 assert_eq( t.str, "class" ); 32 assert( !t.quoted ); 32 assert( !t.quoted ); 33 assert_eq( t, new Token(p, "class", false) ); 33 assert_eq( t, new Token(p, "class", false) ); ................................................................................................................................................................................ 369 /// Range primitive 369 /// Range primitive 370 typeof(this) save() /*@property*/ 370 typeof(this) save() /*@property*/ 371 { 371 { 372 return this; 372 return this; 373 } 373 } 374 374 375 /// Get the current position 375 /// Get the current position 376 immutable(LexPosition) currentPosition() const | 376 LexPosition currentPosition() const 377 { 377 { 378 return new immutable(LexPosition)(filename, lineno, column); | 378 return new LexPosition(filename, lineno, column); 379 } 379 } 380 } 380 } 381 381 382 unittest 382 unittest 383 { 383 { 384 assert( isForwardRange!(PositionedReader!string) ); 384 assert( isForwardRange!(PositionedReader!string) ); 385 assert( is(ElementType!(PositionedReader!string) == dchar) ); 385 assert( is(ElementType!(PositionedReader!string) == dchar) ); 386 } 386 }
Modified polemy/parse.d from [71d187282fb3ce05] to [2e1caca9f119fc4c].
8 import polemy._common; 8 import polemy._common; 9 import polemy.failure; 9 import polemy.failure; 10 import polemy.lex; 10 import polemy.lex; 11 import polemy.ast; 11 import polemy.ast; 12 import polemy.layer; 12 import polemy.layer; 13 13 14 /// Parse a string and return its AST 14 /// Parse a string and return its AST 15 /// Throws: ParseException, LexException, UnexpectedEOF < 16 15 17 AST parseString(S, T...)(S str, T fn_ln_cn) 16 AST parseString(S, T...)(S str, T fn_ln_cn) 18 { 17 { 19 return parserFromString(str, fn_ln_cn).parse(); 18 return parserFromString(str, fn_ln_cn).parse(); 20 } 19 } 21 20 22 /// Parse the content of a file and return its AST 21 /// Parse the content of a file and return its AST 23 /// Throws: ParseException, LexException, UnexpectedEOF < 24 22 25 AST parseFile(S, T...)(S filename, T ln_cn) 23 AST parseFile(S, T...)(S filename, T ln_cn) 26 { 24 { 27 return parserFromFile(filename, ln_cn).parse(); 25 return parserFromFile(filename, ln_cn).parse(); 28 } 26 } 29 27 30 // Named Constructors of Parser 28 // Named Constructors of Parser ................................................................................................................................................................................ 71 /// Declaration ::= 69 /// Declaration ::= 72 /// ["@" Layer|"let"|"var"|"def"] Var "=" Expression ([";"|"i 70 /// ["@" Layer|"let"|"var"|"def"] Var "=" Expression ([";"|"i 73 /// | ["@" Layer|"let"|"var"|"def"] Var "(" Param%"," ")" "{" B 71 /// | ["@" Layer|"let"|"var"|"def"] Var "(" Param%"," ")" "{" B 74 /// | ["@" "@" Layer "=" Expression ([";"|"in"] Body?)? 72 /// | ["@" "@" Layer "=" Expression ([";"|"in"] Body?)? 75 /// | ["@" "@" Layer "(" Param%"," ")" "{" Body "}" ([";"|"in"] 73 /// | ["@" "@" Layer "(" Param%"," ")" "{" Body "}" ([";"|"in"] 76 74 77 auto pos = currentPosition(); 75 auto pos = currentPosition(); 78 string layer = ""; | 76 Layer layer = ""; 79 bool layerRiseDecl = false; | 77 bool layerLiftDecl = false; 80 78 81 if( tryEat("@") ) 79 if( tryEat("@") ) 82 { 80 { 83 layer = "@" ~ eatId("after @", AllowQuoted); 81 layer = "@" ~ eatId("after @", AllowQuoted); 84 if( layer == "@@" ) 82 if( layer == "@@" ) 85 { 83 { 86 layer = "@" ~ eatId("after @@", AllowQuoted); 84 layer = "@" ~ eatId("after @@", AllowQuoted); 87 layerRiseDecl = true; | 85 layerLiftDecl = true; 88 } 86 } 89 else 87 else 90 { 88 { 91 if( tryEat("(") ) 89 if( tryEat("(") ) 92 return null; // @lay(...) expression, no 90 return null; // @lay(...) expression, no 93 } 91 } 94 } 92 } 95 93 96 // [TODO] Refactor 94 // [TODO] Refactor 97 if( layerRiseDecl ) | 95 if( layerLiftDecl ) 98 { 96 { 99 string kwd = "@" ~ layer; 97 string kwd = "@" ~ layer; 100 string var = layer; 98 string var = layer; 101 99 102 auto e = tryEat("(") 100 auto e = tryEat("(") 103 ? parseLambdaAfterOpenParen(pos) // let var ( . 101 ? parseLambdaAfterOpenParen(pos) // let var ( . 104 : (eat("=", "after "~kwd), E(0)); // let var = . 102 : (eat("=", "after "~kwd), E(0)); // let var = . 105 if( moreDeclarationExists() ) 103 if( moreDeclarationExists() ) 106 return new LetExpression(pos, var, SystemLayer, 104 return new LetExpression(pos, var, SystemLayer, 107 else 105 else 108 return new LetExpression(pos, var, SystemLayer, | 106 return new LetExpression(pos, var, SystemLayer, > 107 new LayeredExpression(pos, SystemLayer, > 108 ); 109 } 109 } 110 else 110 else 111 { 111 { 112 string kwd = layer; 112 string kwd = layer; 113 if( layer.empty && !tryEat(kwd="let") && !tryEat(kwd="va 113 if( layer.empty && !tryEat(kwd="let") && !tryEat(kwd="va 114 return null; // none of {@lay, let, var, def} oc 114 return null; // none of {@lay, let, var, def} oc 115 115 ................................................................................................................................................................................ 389 throw genex!ParseException(currentPosition(), "identifie 389 throw genex!ParseException(currentPosition(), "identifie 390 scope(exit) lex.popFront; 390 scope(exit) lex.popFront; 391 return lex.front.str; 391 return lex.front.str; 392 } 392 } 393 393 394 AST doNothingExpression() 394 AST doNothingExpression() 395 { 395 { 396 return new IntLiteral(currentPosition(), BigInt(178)); | 396 return new StrLiteral(currentPosition(), "(empty function body)" 397 } 397 } 398 398 399 immutable(LexPosition) currentPosition() 399 immutable(LexPosition) currentPosition() 400 { 400 { 401 return lex.empty ? null : lex.front.pos; 401 return lex.empty ? null : lex.front.pos; 402 } 402 } 403 } 403 } ................................................................................................................................................................................ 416 assert_eq(parseString(`1;2;`), let("_","",intl(1),intl(2))); 416 assert_eq(parseString(`1;2;`), let("_","",intl(1),intl(2))); 417 assert_eq(parseString(`let x=1 in 2`), let("x","",intl(1),intl(2))); 417 assert_eq(parseString(`let x=1 in 2`), let("x","",intl(1),intl(2))); 418 assert_eq(parseString(`var x=1;2;`), let("x","",intl(1),intl(2))); 418 assert_eq(parseString(`var x=1;2;`), let("x","",intl(1),intl(2))); 419 assert_eq(parseString(`def x=1`), let("x","",intl(1),var("x"))); 419 assert_eq(parseString(`def x=1`), let("x","",intl(1),var("x"))); 420 assert_eq(parseString(`@val x=1;`), let("x","@val",intl(1),var("x"))); 420 assert_eq(parseString(`@val x=1;`), let("x","@val",intl(1),var("x"))); 421 assert_eq(parseString(`@typ x="#int";`), let("x","@typ",strl("#int"),var 421 assert_eq(parseString(`@typ x="#int";`), let("x","@typ",strl("#int"),var 422 assert_eq(parseString(`f(1,2)`), call(var("f"),intl(1),intl(2))); 422 assert_eq(parseString(`f(1,2)`), call(var("f"),intl(1),intl(2))); 423 assert_eq(parseString(`if(1){2}`), call(var("if"),intl(1),fun([],intl(2) | 423 assert_eq(parseString(`if(1){2}`), call(var("if"),intl(1),fun([],intl(2) 424 assert_eq(parseString(`if(1){2}else{3}`), call(var("if"),intl(1),fun([], 424 assert_eq(parseString(`if(1){2}else{3}`), call(var("if"),intl(1),fun([], 425 assert_eq(parseString(`if(1){}else{3}()()`), 425 assert_eq(parseString(`if(1){}else{3}()()`), 426 call(call(call(var("if"),intl(1),fun([],intl(178)),fun([],intl(3 | 426 call(call(call(var("if"),intl(1),fun([],strl("(empty function bo 427 assert_eq(parseString(`1+2*3`), call(var("+"),intl(1),call(var("*"),intl 427 assert_eq(parseString(`1+2*3`), call(var("+"),intl(1),call(var("*"),intl 428 assert_eq(parseString(`(1+2)*3`), call(var("*"),call(var("+"),intl(1),in 428 assert_eq(parseString(`(1+2)*3`), call(var("*"),call(var("+"),intl(1),in 429 assert_eq(parseString(`1*(2+3)`), call(var("*"),intl(1),call(var("+"),in 429 assert_eq(parseString(`1*(2+3)`), call(var("*"),intl(1),call(var("+"),in 430 assert_eq(parseString(`1*2+3`), call(var("+"),call(var("*"),intl(1),intl 430 assert_eq(parseString(`1*2+3`), call(var("+"),call(var("*"),intl(1),intl 431 assert_eq(parseString(`@x(1)`), lay("@x", intl(1))); 431 assert_eq(parseString(`@x(1)`), lay("@x", intl(1))); 432 assert_eq(parseString(`fun(x @v @t, y, z @t){}`), 432 assert_eq(parseString(`fun(x @v @t, y, z @t){}`), 433 funp([param("x",["@v","@t"]), param("y",[]), param("z",["@t"])], | 433 funp([param("x",["@v","@t"]), param("y",[]), param("z",["@t"])], 434 434 435 assert_eq(parseString(` 435 assert_eq(parseString(` 436 let x = 100; #comment 436 let x = 100; #comment 437 let y = 200; #comment!!!!! 437 let y = 200; #comment!!!!! 438 x+y 438 x+y 439 `), 439 `), 440 let("x", "", intl(100), let("y", "", intl(200), call(var("+"), v 440 let("x", "", intl(100), let("y", "", intl(200), call(var("+"), v ................................................................................................................................................................................ 472 assert_eq(parseString(`def foo(x) { x+1 }; foo`), 472 assert_eq(parseString(`def foo(x) { x+1 }; foo`), 473 let("foo", "", 473 let("foo", "", 474 fun(["x"], call(var("+"), var("x"), intl(1))), 474 fun(["x"], call(var("+"), var("x"), intl(1))), 475 var("foo")) 475 var("foo")) 476 ); 476 ); 477 477 478 assert_eq(parseString(`@@type ( x ) { x }`), 478 assert_eq(parseString(`@@type ( x ) { x }`), 479 let("@type", SystemLayer, fun(["x"], var("x")), var("@type")) ); | 479 let("@type", SystemLayer, fun(["x"], var("x")), lay(SystemLayer, 480 480 481 assert_eq(parseString(`{}`), call(var("{}"))); 481 assert_eq(parseString(`{}`), call(var("{}"))); 482 assert_eq(parseString(`{foo:1,"bar":2}`), 482 assert_eq(parseString(`{foo:1,"bar":2}`), 483 call(var(".="), call(var(".="), call(var("{}")), strl("foo"), in 483 call(var(".="), call(var(".="), call(var("{}")), strl("foo"), in 484 assert_eq(parseString(`{}.foo`), call(var("."),call(var("{}")),strl("foo 484 assert_eq(parseString(`{}.foo`), call(var("."),call(var("{}")),strl("foo 485 assert_eq(parseString(`{}.?foo`), call(var(".?"),call(var("{}")),strl("f 485 assert_eq(parseString(`{}.?foo`), call(var(".?"),call(var("{}")),strl("f 486 assert_eq(parseString(`x{y:1}`), call(var(".="),var("x"),strl("y"),intl( 486 assert_eq(parseString(`x{y:1}`), call(var(".="),var("x"),strl("y"),intl( 487 } 487 }