gpt4 book ai didi

android - ANTLR 和安卓

转载 作者:行者123 更新时间:2023-11-29 15:30:18 25 4
gpt4 key购买 nike

有没有关于如何在 Android 上使用 ANTLR 的指南?我找到了一些适用于 Android 的 ANTLR 移植,但它看起来没有任何教程或手册。你知道在哪里可以找到一些吗? (是的,我一直在谷歌搜索...)

谢谢

最佳答案

阅读此 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

在我看来,唯一的区别是当您想在 Android 设备(或模拟器)上运行解析器时,您必须在 Android 项目/应用程序中包含 AntlrJavaRuntime。

因此,编写语法、从所述语法生成解析器和词法分析器与在“普通”机器上相同。这是之前的问答,展示了如何编写简单的表达式解析器:ANTLR: Is there a simple example?

编辑

另请参阅此问答:android ANTLR make not working properly

关于android - ANTLR 和安卓,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7596609/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com