有没有人看过解析器生成器性能的良好比较?
我特别感兴趣的是:1)用于LALR(1)语法的递归上升解析器生成器; 2)解析器生成器,它生成基于C/C++的解析器.
让我们举一个常见的例子,说明如何从C函数调用haskell函数:
Haskell模块:
{-# LANGUAGE ForeignFunctionInterface #-}
module Safe where
import Foreign.C.Types
fibonacci :: Int -> Int
fibonacci n = fibs !! n
where fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
fibonacci_hs :: CInt -> CInt
fibonacci_hs = fromIntegral . fibonacci . fromIntegral
foreign export ccall fibonacci_hs :: CInt -> CInt
Run Code Online (Sandbox Code Playgroud)
和C模块:
#include <HsFFI.h>
#ifdef __GLASGOW_HASKELL__
#include "Safe_stub.h"
extern void __stginit_Safe(void);
#endif
#include <stdio.h>
int main(int argc, char *argv[]) {
int i;
hs_init(&argc, &argv);
#ifdef __GLASGOW_HASKELL__
hs_add_root(__stginit_Safe); …Run Code Online (Sandbox Code Playgroud) 我在尝试注册DLL时遇到问题.我的操作系统是Windows 7(x64).
我以两种不同的方式做到这一点:
1)使用regsvr32.我收到消息"DllRegisterServer ... succeedeed",但我在注册表中找不到我的CLSID.(并且我在尝试使用此CLSID创建组件实例时出现"Class not registered"错误.)在这种情况下,我知道DllRegisterServer从未被调用(因为我在此函数的开头创建了一个文本文件而它不是创建).
2)显式加载我的DLL并调用DllRegisterServer.在这种情况下,DllRegisterServer返回S_OK,但仍然无法在注册表中找到我的CLSID并获得"Class not registered"错误.
我确定代码是正确的(因为它不能仅在我的操作系统上运行),所以似乎问题出现在操作系统中.有人遇到过这样的问题吗?