C/AL interpreter

xoxo Member Posts: 34
Has anyone made a C/AL interpreter (with basic sys function library) to enable one to run C/AL outside Navision, e.g. on the web?

Comments

  • WaldoWaldo Member Posts: 3,412
    I'm afraid this does not exist, my friend.

    But wait until next year (NAV 2009) - when web services come available. 8)

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • DenSterDenSter Member Posts: 8,305
    You still won't have C/AL outside of NAV :mrgreen:

    At least a way of exposing NAV functionality, which counts for something
  • idiotidiot Member Posts: 651
    I don't think C/AL will ever become a programming/development language like C++ or .Net
    NAV - Norton Anti Virus

    ERP Consultant (not just Navision) & Navision challenger
  • WaldoWaldo Member Posts: 3,412
    DenSter wrote:
    At least a way of exposing NAV functionality, which counts for something

    That's what I was thinkin about :wink:. You got the business logic outside of NAV.
    I've had the chance to work on a presentation together with a MS employee (which I described here) ... and man-o-man I can't wait till it's available.

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • xoxo Member Posts: 34
    That's not the idea at all. The idea is to be able to prototype C/AL programs outside Navision - even on a cellphone. C/AL is a simple language so it shouldn't be that hard to parse and compile. Hm, maybe a C/AL.NET since C/AL will soon compile to MSIL and MSIL will compile to Javascript with Volta, or so I hear. (With simple functions I don't mean records, necessarily, just primitive functions with primitive datatypes - although with typing enabled).
  • chridochrido Member Posts: 12
    I have build a parser for C/AL which creates an AST a while ago, just to proofe it's possible. (The code is horrible, more just a hack, was done using c# 1.1 )

    The theme just poped up in the recent days once more. (retrofitting a very old and very big navision solution) C# 3.5 compiler has many improvements which makes it easier to implement this whole thing. I'm thinking of building a grammer using http://www.codeplex.com/irony Also this is interesting http://www.iunknown.com/2008/01/latest-dlr-host.html

    Anybody interested in knowhow/code sharing?

    @XO
    I currently don't think going down as deep as MSIL. I think the better way would be creating an AST and based on the AST creating a codegenerator based on CodeDom. C/AL is not turing complete.

    @idiot ;)
    absolutly true. C/AL is not turing complete. But the syntax could be extended to allow new things, like .net access.

    just dreaming a bit, but i think this goal is not that far away

    btw. this have inspired me to try it once more: http://www.langnetsymposium.com/talks.asp
    1-07 - Irony and ERP Language Challenges - Roman Ivantsov
  • xoxo Member Posts: 34
    Nice post Chrido!

    I have set forth to construct my own AST for C/AL in the haXe programming language and after that a parser and after that some code analysis and perhaps even simple optimizations, I'm not sure. I never planned to construct a compiler myself to be honest - on the other hand, once the AST is there, how hard can it be to map to Javascript, or something similar - like haXe. I was considering using a grammer and parser generator tool, but in the end I might as well spend my time creating my own custom AST and parser to more tightly fit my needs. If for nothing else, then for a learning experience.

    If you've already built a parser I would be interested in looking at your code and sharing ideas regarding the AST. Currently my AST-in-progress is implemented using recursive parametric and type parametric enums (like datatype's in SML).

    But since distinct datatypes are not type compatible, there are some constraints that I'm not too happy with in the design. This is my first AST, so maybe I should look at more different AST's to get some ideas. :-)

    To be honest I'm not that excited about coding a grammar in C#. And if Irony uses C# 2.0 it's already somewhat behind the curve in terms of how elegant it can be coded. But maybe expressing the grammar directly via a parser library is the better way...
  • chridochrido Member Posts: 12
    Currently my AST-in-progress is implemented using recursive parametric and type parametric enums (like datatype's in SML).

    I feel ashamed ;) I'm just walking through and watching for ends. (my first try parser also doesn't like if's without ends ;-)) And then i add it as a leaf or as node. That's all, about 150 lines, nothing to be proud of.

    haxe sounds interesting, never heard about it.

    First step is taken. I got irony compiling and running at home on my linux box using mono. The week after easter i will have some time. The first thing I will try to get working is some code without database access, only strings and ints.
  • xoxo Member Posts: 34
    Nothing to be ashamed of - mine isn't even complete, and it sounds fancier than it is. :-)

    I recommend you take a look at haXe: http://www.haxe.org. It is much much more powerful than C/AL and more expressive than C# 3.0 in some ways. The open-source haXe is written in O'Caml, is lightning fast, and has targets for Javascript, Flash bytecode (AS2, AS3) as well as Neko - an bytecode format for the NekoVM, also created by the haXe inventor, Nicolas Cannasse.

    A compiler with just basic types is not uninteresting - it is possible to prototype lots of code with just basic types.

    It would be somewhat of a dream to have C# or haXe targets for C/AL, but on the other hand, if the IDE (C/SIDE) doesn't natively support it, the development experience is not streamlined.

    I'll give a peak at two of my definitions, as they currently are. The easter will hopefully be a good time to expand on them and learn from other AST designs.
Sign In or Register to comment.