Git Product home page Git Product logo

caper's People

Contributors

fum1h1ro avatar jonigata avatar katahiromz avatar kishi123 avatar totoki-kei avatar unaunagi avatar y-fujii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

caper's Issues

/ルールを複数回使うと assertion で落ちる

Foo/... なルールが2回現れると assertion で落ちます。

文法ファイル1

%token Number<int> LParen RParen LBracket RBracket Comma Semicolon Star;
%namespace list;
%dont_use_stl;
%recover error;
%allow_ebnf;

Document<int> : [Document] LParen Number/Comma(0) RParen
              | [] Document2
              ;

Document2<int> : [Document2] LBracket Number/Semicolon(0) RBracket
               ;

出力1

File: grammar.hpp, Line 577

Expression: !exists(r)

文法ファイル2

%token Number<int> LParen RParen LBracket RBracket Comma Semicolon Star;
%namespace list;
%dont_use_stl;
%recover error;
%allow_ebnf;

Document<int> : [Document] LParen Number/Comma(0) RParen
              | [Document2] LBracket Number/Semicolon(0) RBracket
              ;

出力2

File: grammar.hpp, Line 577

Expression: !exists(r)

オプショナルを使うとコンパイルエラーになる

grammer:

%token Exp<Expression*>;
%allow_ebnf;

ast<ASTNode*>
    : [make_exp] Exp?(0)
    ;

c++

#include "../prob3.hpp"

class ASTNode {
};

class Expression : public ASTNode {
};

class SemanticAction {
public:
    void syntax_error()
    {
    }

    void stack_overflow()
    {
    }

    template<class T>
    void upcast(ASTNode*& x, T* y)
    {
        x = y;
    }

    template<class T>
    void downcast(T*& x, ASTNode* y)
    {
        x = static_cast<T*>(y);
    }

    template<class S>
    ASTNode* make_exp(S& x)
    {
        Expression* exp = x ? *x : nullptr;
        return nullptr;
    }
};

void test()
{
    SemanticAction sa;
    caper_parser::Parser<ASTNode*, SemanticAction> parser(sa);
}

output:

error C2440: 'return' : 'ASTNode *' から 'Expression *' に変換できません。

よくわからないが、リストを使うとassertionする

grammer:

%token A B C;
%allow_ebnf;

declaration<int>
    : [make_a] attribute* A
    | [make_b] attribute* B
    ;

attribute<int>
    : [make_c] C
    ;

output:

File: grammar.hpp, Line 577

Expression: !exists(r)

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

非終端記号の型を指定しないと、assertionやコンパイルエラーになることがある

できればエラー行などを表示してほしい。

grammer:

%token Token;

module<>
    : [make_module] decl(0)
    ;

decl<>
    : [make_decl] Token
    ;

output:

File: caper_tgt.cpp, Line 221

Expression: type.name != ""

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

grammer:

%token Token;

module<>
    : [make_module] Token
    ;

c++

#include "../prob1_2.hpp"

class Module {
};

class SemanticAction {
public:
    void syntax_error()
    {
    }

    void stack_overflow()
    {
    }

    template<class T>
    void upcast(Module*& x, T* y)
    {
        x = y;
    }

    template<class T>
    void downcast(T*& x, Module* y)
    {
        x = static_cast<T*>(y);
    }

    Module* make_module()
    {
        return nullptr;
    }
};

void test()
{
    SemanticAction sa;
    caper_parser::Parser<Module*, SemanticAction> parser(sa);
}

output:

error C2065: 'r' : 定義されていない識別子です。
error C2065: 'r' : 定義されていない識別子です。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.