小编lov*_*ike的帖子

在OCaml中构建AST

我正在使用OCaml为Scheme的子集构建递归下降解析器.这是语法:

    S -> a|b|c|(T)
    T -> ST | Epsilon
Run Code Online (Sandbox Code Playgroud)

所以说我有:

   type expr = 
       Num of int | String of string | Tuple of expr * expr
Run Code Online (Sandbox Code Playgroud)

伪代码

这些函数必须返回expr类型来构建AST

parseS  lr =
   if head matches '(' then
     parseL lr
   else
     match tokens a, b, or c
Run Code Online (Sandbox Code Playgroud)

使用第一组S作为标记和'(':

parseL lr = 
   if head matches '(' or the tokens then
       Tuple (parseS lr, parseL lr)
  else
       match Epsilon
Run Code Online (Sandbox Code Playgroud)

我的问题是"我怎么回到Epsilon部分因为我不能回来()?".OCaml函数需要相同的返回类型,即使我为Epsilon部分留空,OCaml仍然采用单元类型.

grammar parsing ocaml

6
推荐指数
1
解决办法
1098
查看次数

无法访问复制到/ var/www /或其他文件夹中的php文件

我正在使用LAMP设置的Ubuntu 12.10.我从Windows PC上的xampp/htdocs复制了一个子目录,其中包含项目文件(php,html,css)到我的ubuntu的/ var/www /.但是,当我从浏览器访问这些文件时(我可以看到目录列表),我在该目录中的所有文件上获得403 Forbidden.因此,我在该目录中创建新的虚拟php文件,以查看我是否可以访问,并且它可以工作.知道可能是什么问题吗?

php apache ubuntu htdocs

5
推荐指数
1
解决办法
3万
查看次数

标签 统计

apache ×1

grammar ×1

htdocs ×1

ocaml ×1

parsing ×1

php ×1

ubuntu ×1