• entries
    626
  • comments
    1446
  • views
    1008232

More syntax speculation

Sign in to follow this  
ApochPiQ

1103 views

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)
Sign in to follow this  


3 Comments


Recommended Comments

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.

Share this comment


Link to comment
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).

Share this comment


Link to comment
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]

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now