More syntax speculation

Published February 14, 2012
Advertisement
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)
Previous Entry Quick Epoch stuffs
0 likes 3 comments

Comments

Washu
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.
February 14, 2012 09:33 AM
Washu
Btw, this is for you:
[code]
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
[/code]

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).
February 14, 2012 09:35 AM
Washu
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...

[CODE]
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
[/CODE]
February 17, 2012 04:47 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement