Jump to content

  • Log In with Google      Sign In   
  • Create Account






More syntax speculation

Posted by ApochPiQ, 14 February 2012 · 826 views

Epoch
I'll just leave this here:


entrypoint :
{
	 integer total = sum(1, 10)
	 printinteger(total)
}

sum : integer begin, integer end -> integer ret = 0
{
	 while(begin < end)
	 {
		  ret += begin
		  ++begin
	 }
}



foo :
{
	 complex i = 0, 1
	 assert(i * i == -1)
}


fib : 0 -> 1
fib : 1 -> 1
fib : integer n -> integer ret = fib(n - 1) + fib(n - 2)





I think this is fine. Although, I don't like "printinteger" and would rather just see a "print" that's overloaded.

I have no trouble at all following the syntax and understanding what is being said by the code.
Btw, this is for you:
Seans-MacBook-Air:EpochCompiler washu$ nm EpochCompiler.dll  | grep ByteCode | head -n 4
0000000000093e70 T _CompileSourceToByteCode
0000000000094310 T _FreeByteCodeBuffer
00000000000943f0 T _GetByteCodeBuffer
0000000000094450 T _GetByteCodeBufferSize

EpochCompiler built on Mac OS-X with CLANG... had to remove the dependency on EpochVM. Fairly simple to remove too, since EpochCompiler only seems to rely on TypeInfo.cpp... that should probably be refactored and eliminated to simplify compilation and also make EpochCompiler more useful (i.e. be able to plug it into a jit or other interpretor than just EpochVM).
I thought you might like this... wrote up a quick .net version of the parser and lexer. No syntax evaluation or anything, just produces an AST and then prints the AST...

Lexing took:  66ms
Parsing took: 0ms
Grammar
	MetaEntities
		Vector
			Members
				Member
					real
						X
				Member
					real
						Y
				Member
					real
						Z
				Member
					dot
						ParamTypeSpec
							Vector
							Vector
						float
		entrypoint
			Parameters

September 2014 »

S M T W T F S
 1 2 3456
78910111213
14151617181920
21222324252627
282930    
PARTNERS