ANTLR和Android [英] ANTLR and Android

查看:307
本文介绍了ANTLR和Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有指导如何使用ANTLR在Android?我已经发现了一些ANTLR portation为Android,但它看起来就像是没有任何教程或手动。你知道在哪里可以找到一些? (是的,我一直在使用Google ...)

THX

解决方案

从这个阅读自述的 ANTLR端口

  

AntlrJavaRuntime - Earlence费尔南德斯,绉项目,VU阿姆斯特丹   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~

     

在运行时可作为外部库对哪些应用程序可以链接。   它提供了必要的机制来执行由ANTLR工具生成的词法分析器/分析器code。   该模型是离线的,在某种意义上说,解析器/词法生成关掉移动电话在台式计算机上。   生成的文件转移到Android项目,然后使用这个库。

     

大厦
  ~~~~~~~~

     
      
  1. 午餐相应的目标
  2.   
  3. 请AntlrJavaRuntime
  4.   
  5. 验证AntlrJavaRuntime.xml放置在/系统的/ etc /权限和AntlrJavaRuntime.jar放置在/系统/框架
  6.   
  7. 在此,您可以运行一个正常的化妆
  8.   

在我看来,唯一的区别是,当你想在Android设备上运行的解析器(或-emulator),你必须包括AntlrJavaRuntime在你的Andr​​oid项目/应用程序。

所以,写入语法,产生一个解析器和词法分析器从所述语法将是相同的正常的机器。这里有一个previous Q&放大器; A显示了如何编写一个简单的EX pression分析器:的 ANTLR:有没有一个简单的例子

修改

另请参阅本Q&功放; A:机器人ANTLR使工作不正常

is there any guide how to use ANTLR on Android? I have found some ANTLR portation for Android but it looks like being without any tutorial or manual. Do you know where to find some? (and yes, I have been googling...)

Thx

解决方案

After reading the README from this ANTLR port:

AntlrJavaRuntime - Earlence Fernandes, The CRePE Project, VU Amsterdam ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The Runtime is available as an external library against which apps can link. It provides the necessary mechanisms to execute Lexer/Parser code generated by the ANTLR tool. The model is offline, in the sense that the parser/lexer is generated off the mobile phone on a desktop computer. The resulting files are transferred to an Android project which then uses this library.

Building
~~~~~~~~

  1. lunch the appropriate target
  2. make AntlrJavaRuntime
  3. verify that AntlrJavaRuntime.xml was placed in /system/etc/permissions and AntlrJavaRuntime.jar was placed in /system/framework
  4. after this, you can run a normal make

It seems to me that the only difference is when you want to run your parser on an Android device (or -emulator) you must include the AntlrJavaRuntime in your Android project/app.

So, writing the grammar, generating a parser and lexer from said grammar would be the same as on a "normal" machine. Here's a previous Q&A that shows how to write a simple expression parser: antlr: is there a simple example?

EDIT

Also see this Q&A: android ANTLR make not working properly

这篇关于ANTLR和Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆