Skip to content

Commit

Permalink
fix language
Browse files Browse the repository at this point in the history
  • Loading branch information
limuy2022 committed Jan 28, 2024
1 parent 3cdf95c commit 5b91f4c
Show file tree
Hide file tree
Showing 57 changed files with 2,105 additions and 613 deletions.
File renamed without changes.
22 changes: 22 additions & 0 deletions .github/workflows/rust_macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Rust

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master", "dev" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- name: Build
run: cd rust&&cargo build
- name: Run tests
run: cd rust&&cargo test
22 changes: 22 additions & 0 deletions .github/workflows/rust_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Rust

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master", "dev" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- name: Build
run: cd rust&&cargo build
- name: Run tests
run: cd rust&&cargo test
93 changes: 1 addition & 92 deletions doc/developer/parser.yy → doc/developer/ebnf.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,3 @@
%skeleton "lalr1.cc" // -*- C++ -*-
%require "3.8.2"
%header

/* %define api.token.raw */

%define api.token.constructor
%define api.value.type variant
%define parse.assert

%code requires {
# include <string>
namespace trc::compiler {
class compiler;
}
}

// The parsing context.
%param { trc::compiler::compiler& drv }

%locations

%define parse.trace
%define parse.error detailed
%define parse.lac full

%code {
# include "compiler.hpp"
}

/* %define api.value.type variant */
%token FOR // for
WHILE // while
IF // if
FUNC // function
CLASS // class
ADD // +
SUB // -
MUL // *
DIV // /
ZDIV // //
MOD // %
POW // **
AND // and
OR // or
NOT // not
EQUAL // ==
UNEQUAL // !=
LESS // <
GREATER // >
LESS_EQUAL // <=
GREATER_EQUAL // >=
IMPORT // import
GOTO // goto
DEL // del
ASSERT // assert
BREAK // break
CONTINUE // continue
SELFADD // +=
SELFSUB // -=
SELFMUL // *=
SELFDIV // /=
SELFZDIV // //=
SELFMOD // %=
SELFPOW // **=
ASSIGN // =
STORE // :=
NAME // 名称
NULL_ // null
TRUE_ // true
FALSE_ // false
STRING_VALUE // 字符串值
LONG_FLOAT_VALUE // 长浮点型值
FLOAT_VALUE // 浮点数值
LONG_INT_VALUE // 长整型值
INT_VALUE // 整型值
LEFT_BIG_BRACE // {
RIGHT_BIG_BRACE // }
LEFT_SMALL_BRACE // (
RIGHT_SMALL_BRACE // )
LEFT_MID_BRACE // [
RIGHT_MID_BRACE // ]
POINT //.
COMMA // ,
ELSE
IN
RETURN
PUBLIC
PRIVATE
%start program
%%
program : statements
statements : statements statement | statement
statement :
Expand Down Expand Up @@ -173,4 +82,4 @@ classdef :
CLASS NAME LEFT_SMALL_BRACE NAME RIGHT_SMALL_BRACE LEFT_BIG_BRACE opt_funcdef_valdef RIGHT_BIG_BRACE
assert : ASSERT expr
del : DEL expr
%%

Binary file added locales/zh_CN/LC_MESSAGES/trans.mo
Binary file not shown.
62 changes: 29 additions & 33 deletions locales/zh_CN/LC_MESSAGES/trans.po
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

msgid "NamaError"
msgstr "名字错误:"

Expand Down Expand Up @@ -47,11 +46,11 @@ msgstr "运算符错误:"
msgid "RedefinedError"
msgstr "重定义错误:"

msgid "Error from "
msgstr "错误来自"
msgid "Error from {}"
msgstr "错误来自{}"

msgid "Error in line"
msgstr "错误发生在行"
msgid "Error in line {}"
msgstr "错误发生在行{}"

msgid "Name \"%s\" is not defined."
msgstr "名字\"%s\"没有被定义."
Expand All @@ -68,7 +67,7 @@ msgstr "无法从操作系统中申请内存."
msgid "\"%s\" division by zero."
msgstr "\"%s\"被零除"

msgid "Could't find \"%\s\" module."
msgid "Could't find \"{}\" module."
msgstr "无法找到\"%s\"模块."

msgid "Key \"%s\" is not defined."
Expand All @@ -77,11 +76,11 @@ msgstr "键\"%s\"未定义"
msgid "%s is out of %s"
msgstr "%超出了%的范围"

msgid "\"%s\" could not be \"%s\"""
msgid "\"%s\" could not be \"%s\""
msgstr "\"%s\"不能被转换为\"%s\""

msgid "Couldn't use %s for types:%s and %s"
msgstr "不能使用运算符\"%s\"对于类型:%s and %s"
msgid "Couldn't use {} for types:{} and {}"
msgstr "不能使用运算符\"{}\"对于类型:{}和{}"

msgid "Function %s is redefined"
msgstr "函数%s被重定义"
Expand All @@ -95,17 +94,17 @@ msgstr "%s需要%s个参数."
msgid "Number %s is incorrect."
msgstr "数字%s不正确."

msgid "The string isn't end with \" or \'"
msgstr "这个字符串不以\"\'结尾"
msgid "The string isn't end with \" or '"
msgstr "这个字符串不以\"或'结尾"

msgid "%s is not be expected."
msgstr "%s是不被期待的"

msgid "%s is excepted."
msgstr "%s是被期待的.";
msgid "{} is excepted."
msgstr "{}是被期待的."

msgid "Comments should end with */"
msgstr "多行注释应当以*/结尾";
msgstr "多行注释应当以*/结尾"

msgid "Escape character %s is not defined."
msgstr "转义字符%s未定义."
Expand All @@ -126,37 +125,34 @@ msgid "Dll %s was not found"
msgstr "找不到dll\"%s\""


msgid "The program executed code that should not have been executed.Please
report the problem to the Github repository."
msgstr "这个项目运行了不应该被运行的代码
.请将这个问题报告给github仓库";
msgid "The program executed code that should not have been executed.Please report the problem to the Github repository."
msgstr "这个项目运行了不应该被运行的代码.请将这个问题报告给github仓库"

msgid "Trc:\"%s\" is not a ctree file.Because its
magic number is error\n"
msgstr "Trc:\"%s\"不是一个ctree文件.因为它的魔数不正确.\n"
msgid "Trc:\"{}\" is not a ctree file.Because its magic number is error\n"
msgstr "Trc:\"{}\"不是一个ctree文件.因为它的魔数不正确.\n"

msgid "Trc is a stack programming language. This
project implements most of the modern
programming language basics, provides a perfect
tool chain, which is suitable for working
scripts or embedded in your projects, and helps
msgid "Trc is a stack programming language. This \
project implements most of the modern \
programming language basics, provides a perfect \
tool chain, which is suitable for working \
scripts or embedded in your projects, and helps \
to learn how to compile. "
msgstr "Trc是一门基于栈的编程语言。这个项目实现
了大部分现代编程语言的功能,提供了一个完
善的工具链。它很方便被嵌入到你的项目中或
msgstr "Trc是一门基于栈的编程语言。这个项目实现\
了大部分现代编程语言的功能,提供了一个完\
善的工具链。它很方便被嵌入到你的项目中或\
者作为工作脚本,也可以帮助你去学习编译原理."

msgid "mode is not defined.\n"
msgstr "模式没有被定义\n";
msgstr "模式没有被定义\n"

msgid "var"
msgstr "变量"

msgid " is not defined.\n"
msgstr "没有被定义"
msgstr "没有被定义.\n"

msgid "Trc debugger is running.You can read 'doc/use/TDB.md' to find the help."
msgstr "trc的调试器正在运行.你可以阅读'doc/
msgid "Trc debugger is running.You can read 'doc/use/TDB.md' to find the help.\n"
msgstr "trc的调试器正在运行.你可以阅读'doc/\
use/TDB.md'以寻找帮助.\n"

msgid "instruction"
Expand Down
Loading

0 comments on commit 5b91f4c

Please sign in to comment.