我的语法允许:
C ?id := E // 将值/表达式赋给变量 (VAR)
C ?打印(id)//打印变量(VAR)值
为了完成它,我的 lex 文件是:
[a-z]{
yylval.var_index=get_var_index(yytext);
return VAR;
}
Run Code Online (Sandbox Code Playgroud)
get_var_index 返回列表中变量的索引,如果它不存在则创建一个。这是工作!
该问题是:
我该如何解决?
yacc文件的一部分:
%union {
int int_val;
int var_index;
}
%token <int_val> INTEGER
%token <var_index> VAR
...
| PRINT '(' VAR ')'{
n_lines++;
printf("%d\n",values[$3]);
}
...
| VAR {$$ =values[$1];}
Run Code Online (Sandbox Code Playgroud) 我正在使用一些Acitivity,它工作得很好.但我有一个奇怪的延迟.
我想通了,这是关于代码的这一部分,我在SDCard中加载存储的图像.
if(p.getAdress() != null){
Bitmap bitmap = BitmapFactory.decodeFile(p.getAdress());
new_image.setBackgroundDrawable(null);
new_image.setImageBitmap(bitmap);
}
Run Code Online (Sandbox Code Playgroud)
为什么这个简单的代码执行时间太长?
怎么解决?
如果我取消这个代码,一切都按照我的意愿行事.
我能够在 Android 和 iOS 中成功运行 Android Studio 生成的示例应用程序。我在向导步骤中选择了 CocoaPods。
但是当我将kotlinx-datetime添加到我的依赖项中时,我只能运行 Android 版应用程序。
我的 build.gradle.kts :
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.0")
}
}
...
Run Code Online (Sandbox Code Playgroud)
添加库时出现以下错误:
> Task :shared:linkDebugFrameworkIosX64 FAILED
e: Compilation failed: Expecting descriptor for kotlin.time/TimeMark.<init>|-5645683436151566731[0]
* Source files:
* Compiler version info: Konan: 1.7.0 / Kotlin: 1.7.20
* Output kind: STATIC_CACHE
e: java.lang.IllegalStateException: Expecting descriptor for kotlin.time/TimeMark.<init>|-5645683436151566731[0]
Run Code Online (Sandbox Code Playgroud)
如何重现:
有什么想法如何解决这个问题吗?