http://www.cs.chalmers.se/Cs/Research/Language-technology/BNFC/
我该如何编写带标签的BNF来让BNFC为我生成一个INI解析器?
我到目前为止只有o__O!
entrypoints File ;
comment "#" ;
token ID ( letter | digit | ["-_'"] )+ ;
Ini. File ::= [Section] ;
Sect. Section ::= "[" ID "]" [Statement] ;
Bind. Statement ::= ID "=" ID ;
separator Statement "\n" ;
terminator Section "" ;
Run Code Online (Sandbox Code Playgroud)
[name]
#x = 10
y = 20
Run Code Online (Sandbox Code Playgroud)
Parse Successful!
[Abstract Syntax]
Ini [Sect (ID "name") [Bind (ID "y") (ID "20")]]
[Linearized tree]
[name]y = 20
Run Code Online (Sandbox Code Playgroud)
[name]
x = 10
#y = 20
Run Code Online (Sandbox Code Playgroud)
Parse …Run Code Online (Sandbox Code Playgroud) & Eacute ; \u00C9
& egrave ; \u00E8
& eacute ; \u00E9
& apos ; \u0027
Run Code Online (Sandbox Code Playgroud)
就像是:
f("'") = '\u0027' where f :: string -> char
g('\u0027') = "'" where g :: char -> string
Run Code Online (Sandbox Code Playgroud)
或者是否有第三方库具有BSD或MIT风格的许可免费许可证?否则我将不得不创建自己的映射,但它非常紧急,我不想错过可用的功能.
Windows仅向Windows Vista提供GetTickCount,并从该操作系统开始提供GetTickCount64.如何通过调用不同的函数来编译C程序?
如何让C编译器检查是否在包含的头文件中声明了一个函数,并根据该特定函数是否可用来编译代码的不同部分?
#if ??????????????????????????????
unsigned long long get_tick_count(void) { return GetTickCount64(); }
#else
unsigned long long get_tick_count(void) { return GetTickCount(); }
#endif
Run Code Online (Sandbox Code Playgroud)
寻找工作样本文件而不仅仅是提示.
编辑:我在(64位)Windows 7 RC上使用minGW中的gcc 3.4.5尝试了以下操作,但它没有帮助.如果这是MinGW问题,我该如何解决这个问题?
#include <windows.h>
#if (WINVER >= 0x0600)
unsigned long long get_tick_count(void) { return 600/*GetTickCount64()*/; }
#else
unsigned long long get_tick_count(void) { return 0/*GetTickCount()*/; }
#endif
Run Code Online (Sandbox Code Playgroud) 我正在使用的软件使用全小写符号名称将NETLIB BLAS/LAPACK嵌入其源代码但现在将应用程序移植到Windows时我发现英特尔MKL和此平台的其他几种BLAS/LAPACK实现使用全大写符号名.有没有办法告诉gnu编译器/链接器在匹配符号名称时忽略大小写?
.
.
.
undefined reference to `_dgeqp3'
.
.
.
$ nm /lib/LAPACK.lib | grep -i " T _dgeqp3"
00000000 T _DGEQP3
Run Code Online (Sandbox Code Playgroud) 我在Haskell sendfile包中找到了这段代码:
-- sendfile64 gives LFS support
foreign import ccall unsafe "sendfile64" c_sendfile
:: Fd -> Fd -> Ptr (#type off64_t) -> (#type size_t) -> IO (#type ssize_t)
Run Code Online (Sandbox Code Playgroud)
1)什么#type意思和2)为什么我会得到这个错误,
[1 of 1] Compiling Linux.Splice ( splice.hs, splice.o )
splice.hs:40:12: parse error on input `type'
Run Code Online (Sandbox Code Playgroud)
当我自己尝试使用它如下?:
ghc --make splice.hs
Run Code Online (Sandbox Code Playgroud)
splice.hs:
{-# LANGUAGE ForeignFunctionInterface #-}
module Linux.Splice where
import Data.Word
import System.Posix.Types
-- SPLICE
-- fcntl.h
-- ssize_t splice(
-- int fd_in,
-- loff_t* off_in,
-- int fd_out, …Run Code Online (Sandbox Code Playgroud) 在我正在开发的应用程序中,我splice在Linux上用于套接字到套接字数据传输.
splice或等效的解决方案?splice使用sendfile¹+ memmap¹ 模拟Windows上的套接字到套接字数据?¹两者都存在于不同名称的Windows上,我不记得了.
更新
您可以splice在Linux上看到vs用户空间缓冲区的性能改进.
DF,DR,F,MF,MR是我在不同隧道模式的应用,NX是NGINX Web服务器-p+t 使用Linux系统调用 splice+p-t 使用带有用户空间缓冲区的便携式实现+p+t 使用具有用户空间缓冲区和多个OS线程的可移植实现这个问题导致F#3.0中一个独立于流类型的parsec实现 - 受到FParsec的启发,从CharStreams中解放出来并简化:http://corsis.github.com/XParsec/
在FParsec启发的流类型独立的简单parsec实现中,我想知道如何在类型级别区分以下内容:
具体来说,我如何限制F#
many1?skipMany1?'?仅使用类型声明为使用流的解析器?
F#是否提供了与Haskell类似的构造newtype?
是否有更多F#特定的方法来解决这个问题?
// Copyright (c) Cetin Sert 2012
// License: Simplified BSD.
#if INTERACTIVE
#else
module XParsec
#endif
open System
open System.Collections.Generic
module Streams =
type 'a ArrayEnumerator (a : 'a [], ?i : int) as e =
let l = a.Length
let mutable s = -1 |> defaultArg i
member e.Current = a.[s]
member e.Reset () = s <- -1 |> defaultArg …Run Code Online (Sandbox Code Playgroud) 我在 Visual Studio 2012 中使用 F# 时遇到了一个我不明白的编译时错误。
我可以在这里找到一个最小的片段:http : //ideone.com/hbhbF
type Foo() =
inherit System.Exception()
member inline this.Bar() = ()
Foo().Bar()
Run Code Online (Sandbox Code Playgroud)
以下错误消息是什么意思?
/home/iU0RLi/prog.fs(3,22): error FS0073: internal error: the mustinline value 'Bar' was not inferred to have a known value
/home/iU0RLi/prog.fs(5,1): error FS1114: The value 'Prog.Foo.Bar' was marked inline but was not bound in the optimization environment
/home/iU0RLi/prog.fs(3,22): error FS1113: The value 'Bar' was marked inline but its implementation makes use of an internal or private function which is not …Run Code Online (Sandbox Code Playgroud) 即将从源代码编译 libevent,我刚刚注意到它似乎依赖于 OpenSSL 进行加密o_O。
这听起来像是臃肿。
libevent-2.0.21-stable/自述文件
38 The configure script also supports the following flags:
39
40 --enable-gcc-warnings Enable extra compiler checking with GCC.
41 --disable-malloc-replacement
42 Don't let applications replace our memory
43 management functions
44 --disable-openssl Disable support for OpenSSL encryption.
45 --disable-thread-support Don't support multithreaded environments.
Run Code Online (Sandbox Code Playgroud) (请忽略空方块。)
如何<span>在第二种情况下正确定位蓝色元素?
<view style="height: 45em;">
<pdf-page> <!-- position: relative -->
<text class="textLayer"> <!-- position: absolute -->
<span style="left: 417.34px; top: 37.8391px; ..."></span> <!-- position: absolute -->
</text>
<svg width="595px" height="842px" preserveAspectRatio="none" viewBox="0 0 595 842" xmlns="http://www.w3.org/2000/svg" version="1.1">
<g ?><g ?><text><tspan></tspan></text></g></g>
</svg>
</pdf-page>
</view>
Run Code Online (Sandbox Code Playgroud)
这是 stackoverflow 中的完整案例(/* ? */在单击 Show code snippet 后查看第二个窗格):
@namespace url(http://www.w3.org/1999/xhtml);
@namespace svg url(http://www.w3.org/2000/svg);
/*pdf.css*/ …Run Code Online (Sandbox Code Playgroud)f# ×3
haskell ×3
c ×2
types ×2
.net ×1
bnf ×1
c# ×1
compilation ×1
css ×1
css-position ×1
dependencies ×1
ebnf ×1
encryption ×1
ffi ×1
gcc ×1
html ×1
inline ×1
libevent ×1
linker ×1
macros ×1
mupdf ×1
newtype ×1
openssl ×1
parsec ×1
parsing ×1
pdfjs ×1
sockets ×1
splice ×1
symbols ×1
system-calls ×1
unicode ×1