#643 √ invalid
Evan Phoenix

Port parser primitive to C++

Reported by Evan Phoenix | July 15th, 2008 @ 01:56 PM | in Iteration 1

grammar*.c need to be ported into the C++ VM.

Comments and changes to this ticket

  • Evan Phoenix

    Evan Phoenix July 16th, 2008 @ 03:04 PM

    There are 2 main parts to the parser primitive. The grammar.y, which is an extracted version of parse.y, and grammar_runtime.c, which contains a version of parsetree.

    It very well maybe possible to get grammar.y to compile if the whole thing is compiled with gcc (ie, as C) instead of g++. Then it's symbols need to be declared extern C so they can be accessed. grammar.y is entirely standalone, meaning it doesn't use any datastructures from the VM. It uses a couple of external_libs to track symbols and such, but thats all.

    grammar_runtime.c is the glue between the parser data structures and the VM ones. It needs to be adjusted to use the new, C++ APIs to access objects rather than the shotgun functions.

    A quick and dirty approach here would be to just #define all the shotgun functions to become calls to the C++ objects. Since grammar_runtime.c only has access String, Fixnum, and Array, this should be relatively easy.

    Lastly, the primitive interface code has to be ported. This should be pretty straightforward, since the grammar functions used (syd_compile_string and syd_compile_file) just take simple arguments and return the sexp.

  • Ryan Davis

    Ryan Davis September 29th, 2008 @ 02:56 AM

    • → State changed from “new” to “invalid”

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket