forked from NUDT-compiler/nudt-compiler-cpp
Compare commits
8 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
6faa67fb65 | 2 weeks ago |
|
|
9184ba9c9d | 2 weeks ago |
|
|
c33d36e040 | 2 weeks ago |
|
|
97d5ec1d48 | 2 weeks ago |
|
|
f16c29db26 | 2 weeks ago |
|
|
04a29b2bf9 | 2 weeks ago |
|
|
477720eb5e | 2 weeks ago |
|
|
192b8004ed | 3 weeks ago |
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "nudt-compiler-cpp",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,3 @@
|
||||
This project is dual-licensed under the Unlicense and MIT licenses.
|
||||
|
||||
You may use this code under the terms of either license.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,46 @@
|
||||
# `@img/sharp-libvips-linux-x64`
|
||||
|
||||
Prebuilt libvips and dependencies for use with sharp on Linux (glibc) x64.
|
||||
|
||||
## Licensing
|
||||
|
||||
This software contains third-party libraries
|
||||
used under the terms of the following licences:
|
||||
|
||||
| Library | Used under the terms of |
|
||||
|---------------|-----------------------------------------------------------------------------------------------------------|
|
||||
| aom | BSD 2-Clause + [Alliance for Open Media Patent License 1.0](https://aomedia.org/license/patent-license/) |
|
||||
| cairo | Mozilla Public License 2.0 |
|
||||
| cgif | MIT Licence |
|
||||
| expat | MIT Licence |
|
||||
| fontconfig | [fontconfig Licence](https://gitlab.freedesktop.org/fontconfig/fontconfig/blob/main/COPYING) (BSD-like) |
|
||||
| freetype | [freetype Licence](https://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/FTL.TXT) (BSD-like) |
|
||||
| fribidi | LGPLv3 |
|
||||
| glib | LGPLv3 |
|
||||
| harfbuzz | MIT Licence |
|
||||
| highway | Apache-2.0 License, BSD 3-Clause |
|
||||
| lcms | MIT Licence |
|
||||
| libarchive | BSD 2-Clause |
|
||||
| libexif | LGPLv3 |
|
||||
| libffi | MIT Licence |
|
||||
| libheif | LGPLv3 |
|
||||
| libimagequant | [BSD 2-Clause](https://github.com/lovell/libimagequant/blob/main/COPYRIGHT) |
|
||||
| libnsgif | MIT Licence |
|
||||
| libpng | [libpng License](https://github.com/pnggroup/libpng/blob/master/LICENSE) |
|
||||
| librsvg | LGPLv3 |
|
||||
| libspng | [BSD 2-Clause, libpng License](https://github.com/randy408/libspng/blob/master/LICENSE) |
|
||||
| libtiff | [libtiff License](https://gitlab.com/libtiff/libtiff/blob/master/LICENSE.md) (BSD-like) |
|
||||
| libvips | LGPLv3 |
|
||||
| libwebp | New BSD License |
|
||||
| libxml2 | MIT Licence |
|
||||
| mozjpeg | [zlib License, IJG License, BSD-3-Clause](https://github.com/mozilla/mozjpeg/blob/master/LICENSE.md) |
|
||||
| pango | LGPLv3 |
|
||||
| pixman | MIT Licence |
|
||||
| proxy-libintl | LGPLv3 |
|
||||
| zlib-ng | [zlib Licence](https://github.com/zlib-ng/zlib-ng/blob/develop/LICENSE.md) |
|
||||
|
||||
Use of libraries under the terms of the LGPLv3 is via the
|
||||
"any later version" clause of the LGPLv2 or LGPLv2.1.
|
||||
|
||||
Please report any errors or omissions via
|
||||
https://github.com/lovell/sharp-libvips/issues/new
|
||||
@ -0,0 +1,221 @@
|
||||
/* glibconfig.h
|
||||
*
|
||||
* This is a generated file. Please modify 'glibconfig.h.in'
|
||||
*/
|
||||
|
||||
#ifndef __GLIBCONFIG_H__
|
||||
#define __GLIBCONFIG_H__
|
||||
|
||||
#include <glib/gmacros.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#define GLIB_HAVE_ALLOCA_H
|
||||
|
||||
#define GLIB_STATIC_COMPILATION 1
|
||||
#define GOBJECT_STATIC_COMPILATION 1
|
||||
#define GIO_STATIC_COMPILATION 1
|
||||
#define GMODULE_STATIC_COMPILATION 1
|
||||
#define GI_STATIC_COMPILATION 1
|
||||
#define G_INTL_STATIC_COMPILATION 1
|
||||
#define FFI_STATIC_BUILD 1
|
||||
|
||||
/* Specifies that GLib's g_print*() functions wrap the
|
||||
* system printf functions. This is useful to know, for example,
|
||||
* when using glibc's register_printf_function().
|
||||
*/
|
||||
#define GLIB_USING_SYSTEM_PRINTF
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define G_MINFLOAT FLT_MIN
|
||||
#define G_MAXFLOAT FLT_MAX
|
||||
#define G_MINDOUBLE DBL_MIN
|
||||
#define G_MAXDOUBLE DBL_MAX
|
||||
#define G_MINSHORT SHRT_MIN
|
||||
#define G_MAXSHORT SHRT_MAX
|
||||
#define G_MAXUSHORT USHRT_MAX
|
||||
#define G_MININT INT_MIN
|
||||
#define G_MAXINT INT_MAX
|
||||
#define G_MAXUINT UINT_MAX
|
||||
#define G_MINLONG LONG_MIN
|
||||
#define G_MAXLONG LONG_MAX
|
||||
#define G_MAXULONG ULONG_MAX
|
||||
|
||||
typedef signed char gint8;
|
||||
typedef unsigned char guint8;
|
||||
|
||||
typedef signed short gint16;
|
||||
typedef unsigned short guint16;
|
||||
|
||||
#define G_GINT16_MODIFIER "h"
|
||||
#define G_GINT16_FORMAT "hi"
|
||||
#define G_GUINT16_FORMAT "hu"
|
||||
|
||||
|
||||
typedef signed int gint32;
|
||||
typedef unsigned int guint32;
|
||||
|
||||
#define G_GINT32_MODIFIER ""
|
||||
#define G_GINT32_FORMAT "i"
|
||||
#define G_GUINT32_FORMAT "u"
|
||||
|
||||
|
||||
#define G_HAVE_GINT64 1 /* deprecated, always true */
|
||||
|
||||
typedef signed long gint64;
|
||||
typedef unsigned long guint64;
|
||||
|
||||
#define G_GINT64_CONSTANT(val) (val##L)
|
||||
#define G_GUINT64_CONSTANT(val) (val##UL)
|
||||
|
||||
#define G_GINT64_MODIFIER "l"
|
||||
#define G_GINT64_FORMAT "li"
|
||||
#define G_GUINT64_FORMAT "lu"
|
||||
|
||||
|
||||
#define GLIB_SIZEOF_VOID_P 8
|
||||
#define GLIB_SIZEOF_LONG 8
|
||||
#define GLIB_SIZEOF_SIZE_T 8
|
||||
#define GLIB_SIZEOF_SSIZE_T 8
|
||||
|
||||
typedef signed long gssize;
|
||||
typedef unsigned long gsize;
|
||||
#define G_GSIZE_MODIFIER "l"
|
||||
#define G_GSSIZE_MODIFIER "l"
|
||||
#define G_GSIZE_FORMAT "lu"
|
||||
#define G_GSSIZE_FORMAT "li"
|
||||
|
||||
#define G_MAXSIZE G_MAXULONG
|
||||
#define G_MINSSIZE G_MINLONG
|
||||
#define G_MAXSSIZE G_MAXLONG
|
||||
|
||||
typedef gint64 goffset;
|
||||
#define G_MINOFFSET G_MININT64
|
||||
#define G_MAXOFFSET G_MAXINT64
|
||||
|
||||
#define G_GOFFSET_MODIFIER G_GINT64_MODIFIER
|
||||
#define G_GOFFSET_FORMAT G_GINT64_FORMAT
|
||||
#define G_GOFFSET_CONSTANT(val) G_GINT64_CONSTANT(val)
|
||||
|
||||
#define G_POLLFD_FORMAT "%d"
|
||||
|
||||
#define GPOINTER_TO_INT(p) ((gint) (glong) (p))
|
||||
#define GPOINTER_TO_UINT(p) ((guint) (gulong) (p))
|
||||
|
||||
#define GINT_TO_POINTER(i) ((gpointer) (glong) (i))
|
||||
#define GUINT_TO_POINTER(u) ((gpointer) (gulong) (u))
|
||||
|
||||
typedef signed long gintptr;
|
||||
typedef unsigned long guintptr;
|
||||
|
||||
#define G_GINTPTR_MODIFIER "l"
|
||||
#define G_GINTPTR_FORMAT "li"
|
||||
#define G_GUINTPTR_FORMAT "lu"
|
||||
|
||||
#define GLIB_MAJOR_VERSION 2
|
||||
#define GLIB_MINOR_VERSION 86
|
||||
#define GLIB_MICRO_VERSION 1
|
||||
|
||||
#define G_OS_UNIX
|
||||
|
||||
#define G_VA_COPY va_copy
|
||||
|
||||
#define G_VA_COPY_AS_ARRAY 1
|
||||
|
||||
#define G_HAVE_ISO_VARARGS 1
|
||||
|
||||
/* gcc-2.95.x supports both gnu style and ISO varargs, but if -ansi
|
||||
* is passed ISO vararg support is turned off, and there is no work
|
||||
* around to turn it on, so we unconditionally turn it off.
|
||||
*/
|
||||
#if __GNUC__ == 2 && __GNUC_MINOR__ == 95
|
||||
# undef G_HAVE_ISO_VARARGS
|
||||
#endif
|
||||
|
||||
#define G_HAVE_GROWING_STACK 0
|
||||
|
||||
#ifndef _MSC_VER
|
||||
# define G_HAVE_GNUC_VARARGS 1
|
||||
#endif
|
||||
|
||||
#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
|
||||
#define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
||||
#define G_GNUC_INTERNAL __hidden
|
||||
#elif defined (__GNUC__) && defined (G_HAVE_GNUC_VISIBILITY)
|
||||
#define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
|
||||
#else
|
||||
#define G_GNUC_INTERNAL
|
||||
#endif
|
||||
|
||||
#define G_THREADS_ENABLED
|
||||
#define G_THREADS_IMPL_POSIX
|
||||
|
||||
#define G_ATOMIC_LOCK_FREE
|
||||
|
||||
#define GINT16_TO_LE(val) ((gint16) (val))
|
||||
#define GUINT16_TO_LE(val) ((guint16) (val))
|
||||
#define GINT16_TO_BE(val) ((gint16) GUINT16_SWAP_LE_BE (val))
|
||||
#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val))
|
||||
|
||||
#define GINT32_TO_LE(val) ((gint32) (val))
|
||||
#define GUINT32_TO_LE(val) ((guint32) (val))
|
||||
#define GINT32_TO_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val))
|
||||
#define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val))
|
||||
|
||||
#define GINT64_TO_LE(val) ((gint64) (val))
|
||||
#define GUINT64_TO_LE(val) ((guint64) (val))
|
||||
#define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val))
|
||||
#define GUINT64_TO_BE(val) (GUINT64_SWAP_LE_BE (val))
|
||||
|
||||
#define GLONG_TO_LE(val) ((glong) GINT64_TO_LE (val))
|
||||
#define GULONG_TO_LE(val) ((gulong) GUINT64_TO_LE (val))
|
||||
#define GLONG_TO_BE(val) ((glong) GINT64_TO_BE (val))
|
||||
#define GULONG_TO_BE(val) ((gulong) GUINT64_TO_BE (val))
|
||||
#define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val))
|
||||
#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val))
|
||||
#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val))
|
||||
#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val))
|
||||
#define GSIZE_TO_LE(val) ((gsize) GUINT64_TO_LE (val))
|
||||
#define GSSIZE_TO_LE(val) ((gssize) GINT64_TO_LE (val))
|
||||
#define GSIZE_TO_BE(val) ((gsize) GUINT64_TO_BE (val))
|
||||
#define GSSIZE_TO_BE(val) ((gssize) GINT64_TO_BE (val))
|
||||
#define G_BYTE_ORDER G_LITTLE_ENDIAN
|
||||
|
||||
#define GLIB_SYSDEF_POLLIN =1
|
||||
#define GLIB_SYSDEF_POLLOUT =4
|
||||
#define GLIB_SYSDEF_POLLPRI =2
|
||||
#define GLIB_SYSDEF_POLLHUP =16
|
||||
#define GLIB_SYSDEF_POLLERR =8
|
||||
#define GLIB_SYSDEF_POLLNVAL =32
|
||||
|
||||
/* No way to disable deprecation warnings for macros, so only emit deprecation
|
||||
* warnings on platforms where usage of this macro is broken */
|
||||
#if defined(__APPLE__) || defined(_MSC_VER) || defined(__CYGWIN__)
|
||||
#define G_MODULE_SUFFIX "so" GLIB_DEPRECATED_MACRO_IN_2_76
|
||||
#else
|
||||
#define G_MODULE_SUFFIX "so"
|
||||
#endif
|
||||
|
||||
typedef int GPid;
|
||||
#define G_PID_FORMAT "i"
|
||||
|
||||
#define GLIB_SYSDEF_AF_UNIX 1
|
||||
#define GLIB_SYSDEF_AF_INET 2
|
||||
#define GLIB_SYSDEF_AF_INET6 10
|
||||
|
||||
#define GLIB_SYSDEF_MSG_OOB 1
|
||||
#define GLIB_SYSDEF_MSG_PEEK 2
|
||||
#define GLIB_SYSDEF_MSG_DONTROUTE 4
|
||||
|
||||
#define G_DIR_SEPARATOR '/'
|
||||
#define G_DIR_SEPARATOR_S "/"
|
||||
#define G_SEARCHPATH_SEPARATOR ':'
|
||||
#define G_SEARCHPATH_SEPARATOR_S ":"
|
||||
|
||||
#undef G_HAVE_FREE_SIZED
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLIBCONFIG_H__ */
|
||||
@ -0,0 +1 @@
|
||||
module.exports = __dirname;
|
||||
Binary file not shown.
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "@img/sharp-libvips-linux-x64",
|
||||
"version": "1.2.4",
|
||||
"description": "Prebuilt libvips and dependencies for use with sharp on Linux (glibc) x64",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/sharp-libvips.git",
|
||||
"directory": "npm/linux-x64"
|
||||
},
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"versions.json"
|
||||
],
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./lib": "./lib/index.js",
|
||||
"./package": "./package.json",
|
||||
"./versions": "./versions.json"
|
||||
},
|
||||
"config": {
|
||||
"glibc": ">=2.26"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
{
|
||||
"aom": "3.13.1",
|
||||
"archive": "3.8.2",
|
||||
"cairo": "1.18.4",
|
||||
"cgif": "0.5.0",
|
||||
"exif": "0.6.25",
|
||||
"expat": "2.7.3",
|
||||
"ffi": "3.5.2",
|
||||
"fontconfig": "2.17.1",
|
||||
"freetype": "2.14.1",
|
||||
"fribidi": "1.0.16",
|
||||
"glib": "2.86.1",
|
||||
"harfbuzz": "12.1.0",
|
||||
"heif": "1.20.2",
|
||||
"highway": "1.3.0",
|
||||
"imagequant": "2.4.1",
|
||||
"lcms": "2.17",
|
||||
"mozjpeg": "0826579",
|
||||
"pango": "1.57.0",
|
||||
"pixman": "0.46.4",
|
||||
"png": "1.6.50",
|
||||
"proxy-libintl": "0.5",
|
||||
"rsvg": "2.61.2",
|
||||
"spng": "0.7.4",
|
||||
"tiff": "4.7.1",
|
||||
"vips": "8.17.3",
|
||||
"webp": "1.6.0",
|
||||
"xml2": "2.15.1",
|
||||
"zlib-ng": "2.2.5"
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
# `@img/sharp-libvips-linuxmusl-x64`
|
||||
|
||||
Prebuilt libvips and dependencies for use with sharp on Linux (musl) x64.
|
||||
|
||||
## Licensing
|
||||
|
||||
This software contains third-party libraries
|
||||
used under the terms of the following licences:
|
||||
|
||||
| Library | Used under the terms of |
|
||||
|---------------|-----------------------------------------------------------------------------------------------------------|
|
||||
| aom | BSD 2-Clause + [Alliance for Open Media Patent License 1.0](https://aomedia.org/license/patent-license/) |
|
||||
| cairo | Mozilla Public License 2.0 |
|
||||
| cgif | MIT Licence |
|
||||
| expat | MIT Licence |
|
||||
| fontconfig | [fontconfig Licence](https://gitlab.freedesktop.org/fontconfig/fontconfig/blob/main/COPYING) (BSD-like) |
|
||||
| freetype | [freetype Licence](https://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/FTL.TXT) (BSD-like) |
|
||||
| fribidi | LGPLv3 |
|
||||
| glib | LGPLv3 |
|
||||
| harfbuzz | MIT Licence |
|
||||
| highway | Apache-2.0 License, BSD 3-Clause |
|
||||
| lcms | MIT Licence |
|
||||
| libarchive | BSD 2-Clause |
|
||||
| libexif | LGPLv3 |
|
||||
| libffi | MIT Licence |
|
||||
| libheif | LGPLv3 |
|
||||
| libimagequant | [BSD 2-Clause](https://github.com/lovell/libimagequant/blob/main/COPYRIGHT) |
|
||||
| libnsgif | MIT Licence |
|
||||
| libpng | [libpng License](https://github.com/pnggroup/libpng/blob/master/LICENSE) |
|
||||
| librsvg | LGPLv3 |
|
||||
| libspng | [BSD 2-Clause, libpng License](https://github.com/randy408/libspng/blob/master/LICENSE) |
|
||||
| libtiff | [libtiff License](https://gitlab.com/libtiff/libtiff/blob/master/LICENSE.md) (BSD-like) |
|
||||
| libvips | LGPLv3 |
|
||||
| libwebp | New BSD License |
|
||||
| libxml2 | MIT Licence |
|
||||
| mozjpeg | [zlib License, IJG License, BSD-3-Clause](https://github.com/mozilla/mozjpeg/blob/master/LICENSE.md) |
|
||||
| pango | LGPLv3 |
|
||||
| pixman | MIT Licence |
|
||||
| proxy-libintl | LGPLv3 |
|
||||
| zlib-ng | [zlib Licence](https://github.com/zlib-ng/zlib-ng/blob/develop/LICENSE.md) |
|
||||
|
||||
Use of libraries under the terms of the LGPLv3 is via the
|
||||
"any later version" clause of the LGPLv2 or LGPLv2.1.
|
||||
|
||||
Please report any errors or omissions via
|
||||
https://github.com/lovell/sharp-libvips/issues/new
|
||||
221
node_modules/@img/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h
generated
vendored
221
node_modules/@img/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h
generated
vendored
@ -0,0 +1,221 @@
|
||||
/* glibconfig.h
|
||||
*
|
||||
* This is a generated file. Please modify 'glibconfig.h.in'
|
||||
*/
|
||||
|
||||
#ifndef __GLIBCONFIG_H__
|
||||
#define __GLIBCONFIG_H__
|
||||
|
||||
#include <glib/gmacros.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#define GLIB_HAVE_ALLOCA_H
|
||||
|
||||
#define GLIB_STATIC_COMPILATION 1
|
||||
#define GOBJECT_STATIC_COMPILATION 1
|
||||
#define GIO_STATIC_COMPILATION 1
|
||||
#define GMODULE_STATIC_COMPILATION 1
|
||||
#define GI_STATIC_COMPILATION 1
|
||||
#define G_INTL_STATIC_COMPILATION 1
|
||||
#define FFI_STATIC_BUILD 1
|
||||
|
||||
/* Specifies that GLib's g_print*() functions wrap the
|
||||
* system printf functions. This is useful to know, for example,
|
||||
* when using glibc's register_printf_function().
|
||||
*/
|
||||
#define GLIB_USING_SYSTEM_PRINTF
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define G_MINFLOAT FLT_MIN
|
||||
#define G_MAXFLOAT FLT_MAX
|
||||
#define G_MINDOUBLE DBL_MIN
|
||||
#define G_MAXDOUBLE DBL_MAX
|
||||
#define G_MINSHORT SHRT_MIN
|
||||
#define G_MAXSHORT SHRT_MAX
|
||||
#define G_MAXUSHORT USHRT_MAX
|
||||
#define G_MININT INT_MIN
|
||||
#define G_MAXINT INT_MAX
|
||||
#define G_MAXUINT UINT_MAX
|
||||
#define G_MINLONG LONG_MIN
|
||||
#define G_MAXLONG LONG_MAX
|
||||
#define G_MAXULONG ULONG_MAX
|
||||
|
||||
typedef signed char gint8;
|
||||
typedef unsigned char guint8;
|
||||
|
||||
typedef signed short gint16;
|
||||
typedef unsigned short guint16;
|
||||
|
||||
#define G_GINT16_MODIFIER "h"
|
||||
#define G_GINT16_FORMAT "hi"
|
||||
#define G_GUINT16_FORMAT "hu"
|
||||
|
||||
|
||||
typedef signed int gint32;
|
||||
typedef unsigned int guint32;
|
||||
|
||||
#define G_GINT32_MODIFIER ""
|
||||
#define G_GINT32_FORMAT "i"
|
||||
#define G_GUINT32_FORMAT "u"
|
||||
|
||||
|
||||
#define G_HAVE_GINT64 1 /* deprecated, always true */
|
||||
|
||||
typedef signed long gint64;
|
||||
typedef unsigned long guint64;
|
||||
|
||||
#define G_GINT64_CONSTANT(val) (val##L)
|
||||
#define G_GUINT64_CONSTANT(val) (val##UL)
|
||||
|
||||
#define G_GINT64_MODIFIER "l"
|
||||
#define G_GINT64_FORMAT "li"
|
||||
#define G_GUINT64_FORMAT "lu"
|
||||
|
||||
|
||||
#define GLIB_SIZEOF_VOID_P 8
|
||||
#define GLIB_SIZEOF_LONG 8
|
||||
#define GLIB_SIZEOF_SIZE_T 8
|
||||
#define GLIB_SIZEOF_SSIZE_T 8
|
||||
|
||||
typedef signed long gssize;
|
||||
typedef unsigned long gsize;
|
||||
#define G_GSIZE_MODIFIER "l"
|
||||
#define G_GSSIZE_MODIFIER "l"
|
||||
#define G_GSIZE_FORMAT "lu"
|
||||
#define G_GSSIZE_FORMAT "li"
|
||||
|
||||
#define G_MAXSIZE G_MAXULONG
|
||||
#define G_MINSSIZE G_MINLONG
|
||||
#define G_MAXSSIZE G_MAXLONG
|
||||
|
||||
typedef gint64 goffset;
|
||||
#define G_MINOFFSET G_MININT64
|
||||
#define G_MAXOFFSET G_MAXINT64
|
||||
|
||||
#define G_GOFFSET_MODIFIER G_GINT64_MODIFIER
|
||||
#define G_GOFFSET_FORMAT G_GINT64_FORMAT
|
||||
#define G_GOFFSET_CONSTANT(val) G_GINT64_CONSTANT(val)
|
||||
|
||||
#define G_POLLFD_FORMAT "%d"
|
||||
|
||||
#define GPOINTER_TO_INT(p) ((gint) (glong) (p))
|
||||
#define GPOINTER_TO_UINT(p) ((guint) (gulong) (p))
|
||||
|
||||
#define GINT_TO_POINTER(i) ((gpointer) (glong) (i))
|
||||
#define GUINT_TO_POINTER(u) ((gpointer) (gulong) (u))
|
||||
|
||||
typedef signed long gintptr;
|
||||
typedef unsigned long guintptr;
|
||||
|
||||
#define G_GINTPTR_MODIFIER "l"
|
||||
#define G_GINTPTR_FORMAT "li"
|
||||
#define G_GUINTPTR_FORMAT "lu"
|
||||
|
||||
#define GLIB_MAJOR_VERSION 2
|
||||
#define GLIB_MINOR_VERSION 86
|
||||
#define GLIB_MICRO_VERSION 1
|
||||
|
||||
#define G_OS_UNIX
|
||||
|
||||
#define G_VA_COPY va_copy
|
||||
|
||||
#define G_VA_COPY_AS_ARRAY 1
|
||||
|
||||
#define G_HAVE_ISO_VARARGS 1
|
||||
|
||||
/* gcc-2.95.x supports both gnu style and ISO varargs, but if -ansi
|
||||
* is passed ISO vararg support is turned off, and there is no work
|
||||
* around to turn it on, so we unconditionally turn it off.
|
||||
*/
|
||||
#if __GNUC__ == 2 && __GNUC_MINOR__ == 95
|
||||
# undef G_HAVE_ISO_VARARGS
|
||||
#endif
|
||||
|
||||
#define G_HAVE_GROWING_STACK 0
|
||||
|
||||
#ifndef _MSC_VER
|
||||
# define G_HAVE_GNUC_VARARGS 1
|
||||
#endif
|
||||
|
||||
#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
|
||||
#define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
||||
#define G_GNUC_INTERNAL __hidden
|
||||
#elif defined (__GNUC__) && defined (G_HAVE_GNUC_VISIBILITY)
|
||||
#define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
|
||||
#else
|
||||
#define G_GNUC_INTERNAL
|
||||
#endif
|
||||
|
||||
#define G_THREADS_ENABLED
|
||||
#define G_THREADS_IMPL_POSIX
|
||||
|
||||
#define G_ATOMIC_LOCK_FREE
|
||||
|
||||
#define GINT16_TO_LE(val) ((gint16) (val))
|
||||
#define GUINT16_TO_LE(val) ((guint16) (val))
|
||||
#define GINT16_TO_BE(val) ((gint16) GUINT16_SWAP_LE_BE (val))
|
||||
#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val))
|
||||
|
||||
#define GINT32_TO_LE(val) ((gint32) (val))
|
||||
#define GUINT32_TO_LE(val) ((guint32) (val))
|
||||
#define GINT32_TO_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val))
|
||||
#define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val))
|
||||
|
||||
#define GINT64_TO_LE(val) ((gint64) (val))
|
||||
#define GUINT64_TO_LE(val) ((guint64) (val))
|
||||
#define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val))
|
||||
#define GUINT64_TO_BE(val) (GUINT64_SWAP_LE_BE (val))
|
||||
|
||||
#define GLONG_TO_LE(val) ((glong) GINT64_TO_LE (val))
|
||||
#define GULONG_TO_LE(val) ((gulong) GUINT64_TO_LE (val))
|
||||
#define GLONG_TO_BE(val) ((glong) GINT64_TO_BE (val))
|
||||
#define GULONG_TO_BE(val) ((gulong) GUINT64_TO_BE (val))
|
||||
#define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val))
|
||||
#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val))
|
||||
#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val))
|
||||
#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val))
|
||||
#define GSIZE_TO_LE(val) ((gsize) GUINT64_TO_LE (val))
|
||||
#define GSSIZE_TO_LE(val) ((gssize) GINT64_TO_LE (val))
|
||||
#define GSIZE_TO_BE(val) ((gsize) GUINT64_TO_BE (val))
|
||||
#define GSSIZE_TO_BE(val) ((gssize) GINT64_TO_BE (val))
|
||||
#define G_BYTE_ORDER G_LITTLE_ENDIAN
|
||||
|
||||
#define GLIB_SYSDEF_POLLIN =1
|
||||
#define GLIB_SYSDEF_POLLOUT =4
|
||||
#define GLIB_SYSDEF_POLLPRI =2
|
||||
#define GLIB_SYSDEF_POLLHUP =16
|
||||
#define GLIB_SYSDEF_POLLERR =8
|
||||
#define GLIB_SYSDEF_POLLNVAL =32
|
||||
|
||||
/* No way to disable deprecation warnings for macros, so only emit deprecation
|
||||
* warnings on platforms where usage of this macro is broken */
|
||||
#if defined(__APPLE__) || defined(_MSC_VER) || defined(__CYGWIN__)
|
||||
#define G_MODULE_SUFFIX "so" GLIB_DEPRECATED_MACRO_IN_2_76
|
||||
#else
|
||||
#define G_MODULE_SUFFIX "so"
|
||||
#endif
|
||||
|
||||
typedef int GPid;
|
||||
#define G_PID_FORMAT "i"
|
||||
|
||||
#define GLIB_SYSDEF_AF_UNIX 1
|
||||
#define GLIB_SYSDEF_AF_INET 2
|
||||
#define GLIB_SYSDEF_AF_INET6 10
|
||||
|
||||
#define GLIB_SYSDEF_MSG_OOB 1
|
||||
#define GLIB_SYSDEF_MSG_PEEK 2
|
||||
#define GLIB_SYSDEF_MSG_DONTROUTE 4
|
||||
|
||||
#define G_DIR_SEPARATOR '/'
|
||||
#define G_DIR_SEPARATOR_S "/"
|
||||
#define G_SEARCHPATH_SEPARATOR ':'
|
||||
#define G_SEARCHPATH_SEPARATOR_S ":"
|
||||
|
||||
#undef G_HAVE_FREE_SIZED
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLIBCONFIG_H__ */
|
||||
@ -0,0 +1 @@
|
||||
module.exports = __dirname;
|
||||
Binary file not shown.
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "@img/sharp-libvips-linuxmusl-x64",
|
||||
"version": "1.2.4",
|
||||
"description": "Prebuilt libvips and dependencies for use with sharp on Linux (musl) x64",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/sharp-libvips.git",
|
||||
"directory": "npm/linuxmusl-x64"
|
||||
},
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"versions.json"
|
||||
],
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./lib": "./lib/index.js",
|
||||
"./package": "./package.json",
|
||||
"./versions": "./versions.json"
|
||||
},
|
||||
"config": {
|
||||
"musl": ">=1.2.2"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
{
|
||||
"aom": "3.13.1",
|
||||
"archive": "3.8.2",
|
||||
"cairo": "1.18.4",
|
||||
"cgif": "0.5.0",
|
||||
"exif": "0.6.25",
|
||||
"expat": "2.7.3",
|
||||
"ffi": "3.5.2",
|
||||
"fontconfig": "2.17.1",
|
||||
"freetype": "2.14.1",
|
||||
"fribidi": "1.0.16",
|
||||
"glib": "2.86.1",
|
||||
"harfbuzz": "12.1.0",
|
||||
"heif": "1.20.2",
|
||||
"highway": "1.3.0",
|
||||
"imagequant": "2.4.1",
|
||||
"lcms": "2.17",
|
||||
"mozjpeg": "0826579",
|
||||
"pango": "1.57.0",
|
||||
"pixman": "0.46.4",
|
||||
"png": "1.6.50",
|
||||
"proxy-libintl": "0.5",
|
||||
"rsvg": "2.61.2",
|
||||
"spng": "0.7.4",
|
||||
"tiff": "4.7.1",
|
||||
"vips": "8.17.3",
|
||||
"webp": "1.6.0",
|
||||
"xml2": "2.15.1",
|
||||
"zlib-ng": "2.2.5"
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "nudt-compiler-cpp",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
{}
|
||||
@ -1,60 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT=$(cd "$(dirname "$0")/.." && pwd)
|
||||
FUNC_DIR="$ROOT/test/test_case/functional"
|
||||
OUT_BASE="$ROOT/test/test_result/function/ir"
|
||||
LOG_DIR="$ROOT/test/test_result/function/ir_logs"
|
||||
VERIFY="$ROOT/scripts/verify_ir.sh"
|
||||
|
||||
mkdir -p "$OUT_BASE"
|
||||
mkdir -p "$LOG_DIR"
|
||||
|
||||
if [ ! -x "$VERIFY" ]; then
|
||||
echo "verify script not executable, trying to run with bash: $VERIFY"
|
||||
fi
|
||||
|
||||
files=("$FUNC_DIR"/*.sy)
|
||||
if [ ${#files[@]} -eq 0 ]; then
|
||||
echo "No .sy files found in $FUNC_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
total=0
|
||||
pass=0
|
||||
fail=0
|
||||
failed_list=()
|
||||
|
||||
for f in "${files[@]}"; do
|
||||
((total++))
|
||||
name=$(basename "$f")
|
||||
echo "=== Test: $name ==="
|
||||
log="$LOG_DIR/${name%.sy}.log"
|
||||
set +e
|
||||
bash "$VERIFY" "$f" "$OUT_BASE" --run >"$log" 2>&1
|
||||
rc=$?
|
||||
set -e
|
||||
if [ $rc -eq 0 ]; then
|
||||
echo "PASS: $name"
|
||||
((pass++))
|
||||
else
|
||||
echo "FAIL: $name (log: $log)"
|
||||
failed_list+=("$name")
|
||||
((fail++))
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
echo "Summary: total=$total pass=$pass fail=$fail"
|
||||
if [ $fail -ne 0 ]; then
|
||||
echo "Failed tests:"; for t in "${failed_list[@]}"; do echo " - $t"; done
|
||||
echo "Tail of failure logs (last 200 lines each):"
|
||||
for t in "${failed_list[@]}"; do
|
||||
logfile="$LOG_DIR/${t%.sy}.log"
|
||||
echo
|
||||
echo "--- $t ---"
|
||||
tail -n 200 "$logfile" || true
|
||||
done
|
||||
fi
|
||||
|
||||
exit $fail
|
||||
@ -0,0 +1,7 @@
|
||||
|
||||
// Generated from SysY.g4 by ANTLR 4.7.2
|
||||
|
||||
|
||||
#include "SysYBaseVisitor.h"
|
||||
|
||||
|
||||
@ -0,0 +1,144 @@
|
||||
|
||||
// Generated from SysY.g4 by ANTLR 4.7.2
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "antlr4-runtime.h"
|
||||
#include "SysYVisitor.h"
|
||||
|
||||
|
||||
/**
|
||||
* This class provides an empty implementation of SysYVisitor, which can be
|
||||
* extended to create a visitor which only needs to handle a subset of the available methods.
|
||||
*/
|
||||
class SysYBaseVisitor : public SysYVisitor {
|
||||
public:
|
||||
|
||||
virtual antlrcpp::Any visitCompUnit(SysYParser::CompUnitContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitDecl(SysYParser::DeclContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitConstDecl(SysYParser::ConstDeclContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitBType(SysYParser::BTypeContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitConstDef(SysYParser::ConstDefContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitConstInitVal(SysYParser::ConstInitValContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitVarDecl(SysYParser::VarDeclContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitVarDef(SysYParser::VarDefContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitInitVal(SysYParser::InitValContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitFuncDef(SysYParser::FuncDefContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitFuncType(SysYParser::FuncTypeContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitFuncFParams(SysYParser::FuncFParamsContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitFuncFParam(SysYParser::FuncFParamContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitBlock(SysYParser::BlockContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitBlockItem(SysYParser::BlockItemContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitStmt(SysYParser::StmtContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitExp(SysYParser::ExpContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitCond(SysYParser::CondContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitLVal(SysYParser::LValContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitPrimaryExp(SysYParser::PrimaryExpContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitNumber(SysYParser::NumberContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitUnaryExp(SysYParser::UnaryExpContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitUnaryOp(SysYParser::UnaryOpContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitFuncRParams(SysYParser::FuncRParamsContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitMulExp(SysYParser::MulExpContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitAddExp(SysYParser::AddExpContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitRelExp(SysYParser::RelExpContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitEqExp(SysYParser::EqExpContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitLAndExp(SysYParser::LAndExpContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitLOrExp(SysYParser::LOrExpContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
virtual antlrcpp::Any visitConstExp(SysYParser::ConstExpContext *ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
@ -0,0 +1,377 @@
|
||||
|
||||
// Generated from SysY.g4 by ANTLR 4.7.2
|
||||
|
||||
|
||||
#include "SysYLexer.h"
|
||||
|
||||
|
||||
using namespace antlr4;
|
||||
|
||||
|
||||
SysYLexer::SysYLexer(CharStream *input) : Lexer(input) {
|
||||
_interpreter = new atn::LexerATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache);
|
||||
}
|
||||
|
||||
SysYLexer::~SysYLexer() {
|
||||
delete _interpreter;
|
||||
}
|
||||
|
||||
std::string SysYLexer::getGrammarFileName() const {
|
||||
return "SysY.g4";
|
||||
}
|
||||
|
||||
const std::vector<std::string>& SysYLexer::getRuleNames() const {
|
||||
return _ruleNames;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& SysYLexer::getChannelNames() const {
|
||||
return _channelNames;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& SysYLexer::getModeNames() const {
|
||||
return _modeNames;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& SysYLexer::getTokenNames() const {
|
||||
return _tokenNames;
|
||||
}
|
||||
|
||||
dfa::Vocabulary& SysYLexer::getVocabulary() const {
|
||||
return _vocabulary;
|
||||
}
|
||||
|
||||
const std::vector<uint16_t> SysYLexer::getSerializedATN() const {
|
||||
return _serializedATN;
|
||||
}
|
||||
|
||||
const atn::ATN& SysYLexer::getATN() const {
|
||||
return _atn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Static vars and initialization.
|
||||
std::vector<dfa::DFA> SysYLexer::_decisionToDFA;
|
||||
atn::PredictionContextCache SysYLexer::_sharedContextCache;
|
||||
|
||||
// We own the ATN which in turn owns the ATN states.
|
||||
atn::ATN SysYLexer::_atn;
|
||||
std::vector<uint16_t> SysYLexer::_serializedATN;
|
||||
|
||||
std::vector<std::string> SysYLexer::_ruleNames = {
|
||||
u8"T__0", u8"T__1", u8"T__2", u8"T__3", u8"T__4", u8"T__5", u8"T__6",
|
||||
u8"T__7", u8"T__8", u8"T__9", u8"T__10", u8"T__11", u8"T__12", u8"T__13",
|
||||
u8"T__14", u8"T__15", u8"T__16", u8"T__17", u8"T__18", u8"T__19", u8"T__20",
|
||||
u8"T__21", u8"T__22", u8"T__23", u8"T__24", u8"T__25", u8"T__26", u8"T__27",
|
||||
u8"T__28", u8"T__29", u8"T__30", u8"T__31", u8"T__32", u8"DIGIT", u8"HEXDIGIT",
|
||||
u8"EXP", u8"PEXP", u8"FloatConst", u8"IntConst", u8"Ident", u8"WS", u8"LINE_COMMENT",
|
||||
u8"BLOCK_COMMENT"
|
||||
};
|
||||
|
||||
std::vector<std::string> SysYLexer::_channelNames = {
|
||||
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
|
||||
};
|
||||
|
||||
std::vector<std::string> SysYLexer::_modeNames = {
|
||||
u8"DEFAULT_MODE"
|
||||
};
|
||||
|
||||
std::vector<std::string> SysYLexer::_literalNames = {
|
||||
"", u8"'const'", u8"','", u8"';'", u8"'int'", u8"'float'", u8"'['", u8"']'",
|
||||
u8"'='", u8"'{'", u8"'}'", u8"'('", u8"')'", u8"'void'", u8"'if'", u8"'else'",
|
||||
u8"'while'", u8"'break'", u8"'continue'", u8"'return'", u8"'+'", u8"'-'",
|
||||
u8"'!'", u8"'*'", u8"'/'", u8"'%'", u8"'<'", u8"'>'", u8"'<='", u8"'>='",
|
||||
u8"'=='", u8"'!='", u8"'&&'", u8"'||'"
|
||||
};
|
||||
|
||||
std::vector<std::string> SysYLexer::_symbolicNames = {
|
||||
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", u8"FloatConst",
|
||||
u8"IntConst", u8"Ident", u8"WS", u8"LINE_COMMENT", u8"BLOCK_COMMENT"
|
||||
};
|
||||
|
||||
dfa::Vocabulary SysYLexer::_vocabulary(_literalNames, _symbolicNames);
|
||||
|
||||
std::vector<std::string> SysYLexer::_tokenNames;
|
||||
|
||||
SysYLexer::Initializer::Initializer() {
|
||||
// This code could be in a static initializer lambda, but VS doesn't allow access to private class members from there.
|
||||
for (size_t i = 0; i < _symbolicNames.size(); ++i) {
|
||||
std::string name = _vocabulary.getLiteralName(i);
|
||||
if (name.empty()) {
|
||||
name = _vocabulary.getSymbolicName(i);
|
||||
}
|
||||
|
||||
if (name.empty()) {
|
||||
_tokenNames.push_back("<INVALID>");
|
||||
} else {
|
||||
_tokenNames.push_back(name);
|
||||
}
|
||||
}
|
||||
|
||||
_serializedATN = {
|
||||
0x3, 0x608b, 0xa72a, 0x8133, 0xb9ed, 0x417c, 0x3be7, 0x7786, 0x5964,
|
||||
0x2, 0x29, 0x160, 0x8, 0x1, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3,
|
||||
0x4, 0x4, 0x9, 0x4, 0x4, 0x5, 0x9, 0x5, 0x4, 0x6, 0x9, 0x6, 0x4, 0x7,
|
||||
0x9, 0x7, 0x4, 0x8, 0x9, 0x8, 0x4, 0x9, 0x9, 0x9, 0x4, 0xa, 0x9, 0xa,
|
||||
0x4, 0xb, 0x9, 0xb, 0x4, 0xc, 0x9, 0xc, 0x4, 0xd, 0x9, 0xd, 0x4, 0xe,
|
||||
0x9, 0xe, 0x4, 0xf, 0x9, 0xf, 0x4, 0x10, 0x9, 0x10, 0x4, 0x11, 0x9,
|
||||
0x11, 0x4, 0x12, 0x9, 0x12,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0xf, 0x3, 0x10, 0x3, 0x10, 0x3, 0x10, 0x3,
|
||||
0x10, 0x3, 0x10, 0x3, 0x11, 0x3, 0x11, 0x3, 0x11, 0x3, 0x11, 0x3, 0x11,
|
||||
0x3, 0x11, 0x3, 0x12, 0x3, 0x12, 0x3, 0x12, 0x3, 0x12, 0x3, 0x12, 0x3,
|
||||
0x12, 0x3, 0x13, 0x3, 0x13, 0x3, 0x13, 0x3, 0x13, 0x3, 0x13, 0x3, 0x13,
|
||||
0x3, 0x13, 0x3, 0x13, 0x3, 0x13, 0x3, 0x14, 0x3, 0x14, 0x3, 0x14, 0x3,
|
||||
0x14, 0x3, 0x14, 0x3, 0x14, 0x3, 0x14, 0x3, 0x15, 0x3, 0x15, 0x3, 0x16,
|
||||
0x3, 0x16, 0x3, 0x17, 0x3, 0x17, 0x3, 0x18, 0x3, 0x18, 0x3, 0x19, 0x3,
|
||||
0x19, 0x3, 0x1a, 0x3, 0x1a, 0x3, 0x1b, 0x3, 0x1b, 0x3, 0x1c, 0x3, 0x1c,
|
||||
0x3, 0x1d, 0x3, 0x1d, 0x3, 0x1d, 0x3, 0x1e, 0x3, 0x1e, 0x3, 0x1e, 0x3,
|
||||
0x1f, 0x3, 0x1f, 0x3, 0x1f, 0x3, 0x20, 0x3, 0x20, 0x3, 0x20, 0x3, 0x21,
|
||||
0x3, 0x21, 0x3, 0x21, 0x3, 0x22, 0x3, 0x22, 0x3, 0x22, 0x3, 0x23, 0x3,
|
||||
0x23, 0x3, 0x24, 0x3, 0x24, 0x3, 0x25, 0x3, 0x25, 0x5, 0x25, 0xcd, 0xa,
|
||||
0x25, 0x3, 0x25, 0x6, 0x25, 0xd0, 0xa, 0x25, 0xd, 0x25, 0xe, 0x25, 0xd1,
|
||||
0x3, 0x26, 0x3, 0x26, 0x5, 0x26, 0xd6, 0xa, 0x26, 0x3, 0x26, 0x6, 0x26,
|
||||
0xd9, 0xa, 0x26, 0xd, 0x26, 0xe, 0x26, 0xda, 0x3, 0x27, 0x3, 0x27, 0x3,
|
||||
0x27, 0x3, 0x27, 0x5, 0x27, 0xe1, 0xa, 0x27, 0x3, 0x27, 0x6, 0x27, 0xe4,
|
||||
0xa, 0x27, 0xd, 0x27, 0xe, 0x27, 0xe5, 0x3, 0x27, 0x3, 0x27, 0x7, 0x27,
|
||||
0xea, 0xa, 0x27, 0xc, 0x27, 0xe, 0x27, 0xed, 0xb, 0x27, 0x3, 0x27, 0x3,
|
||||
0x27, 0x6, 0x27, 0xf1, 0xa, 0x27, 0xd, 0x27, 0xe, 0x27, 0xf2, 0x3, 0x27,
|
||||
0x6, 0x27, 0xf6, 0xa, 0x27, 0xd, 0x27, 0xe, 0x27, 0xf7, 0x5, 0x27, 0xfa,
|
||||
0xa, 0x27, 0x3, 0x27, 0x3, 0x27, 0x3, 0x27, 0x3, 0x27, 0x6, 0x27, 0x100,
|
||||
0xa, 0x27, 0xd, 0x27, 0xe, 0x27, 0x101, 0x3, 0x27, 0x5, 0x27, 0x105,
|
||||
0xa, 0x27, 0x3, 0x27, 0x6, 0x27, 0x108, 0xa, 0x27, 0xd, 0x27, 0xe, 0x27,
|
||||
0x109, 0x3, 0x27, 0x3, 0x27, 0x7, 0x27, 0x10e, 0xa, 0x27, 0xc, 0x27,
|
||||
0xe, 0x27, 0x111, 0xb, 0x27, 0x3, 0x27, 0x5, 0x27, 0x114, 0xa, 0x27,
|
||||
0x3, 0x27, 0x6, 0x27, 0x117, 0xa, 0x27, 0xd, 0x27, 0xe, 0x27, 0x118,
|
||||
0x3, 0x27, 0x3, 0x27, 0x5, 0x27, 0x11d, 0xa, 0x27, 0x3, 0x28, 0x3, 0x28,
|
||||
0x3, 0x28, 0x7, 0x28, 0x122, 0xa, 0x28, 0xc, 0x28, 0xe, 0x28, 0x125,
|
||||
0xb, 0x28, 0x3, 0x28, 0x3, 0x28, 0x6, 0x28, 0x129, 0xa, 0x28, 0xd, 0x28,
|
||||
0xe, 0x28, 0x12a, 0x3, 0x28, 0x3, 0x28, 0x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, 0xfe, 0x3, 0x2, 0x2, 0x2, 0x100, 0x101, 0x3, 0x2, 0x2, 0x2, 0x101,
|
||||
0xff, 0x3, 0x2, 0x2, 0x2, 0x101, 0x102, 0x3, 0x2, 0x2, 0x2, 0x102, 0x104,
|
||||
0x3, 0x2, 0x2, 0x2, 0x103, 0x105, 0x5, 0x49, 0x25, 0x2, 0x104, 0x103,
|
||||
0x3, 0x2, 0x2, 0x2, 0x104, 0x105, 0x3, 0x2, 0x2, 0x2, 0x105, 0x11d,
|
||||
0x3, 0x2, 0x2, 0x2, 0x106, 0x108, 0x5, 0x45, 0x23, 0x2, 0x107, 0x106,
|
||||
0x3, 0x2, 0x2, 0x2, 0x108, 0x109, 0x3, 0x2, 0x2, 0x2, 0x109, 0x107,
|
||||
0x3, 0x2, 0x2, 0x2, 0x109, 0x10a, 0x3, 0x2, 0x2, 0x2, 0x10a, 0x10b,
|
||||
0x3, 0x2, 0x2, 0x2, 0x10b, 0x10f, 0x7, 0x30, 0x2, 0x2, 0x10c, 0x10e,
|
||||
0x5, 0x45, 0x23, 0x2, 0x10d, 0x10c, 0x3, 0x2, 0x2, 0x2, 0x10e, 0x111,
|
||||
0x3, 0x2, 0x2, 0x2, 0x10f, 0x10d, 0x3, 0x2, 0x2, 0x2, 0x10f, 0x110,
|
||||
0x3, 0x2, 0x2, 0x2, 0x110, 0x113, 0x3, 0x2, 0x2, 0x2, 0x111, 0x10f,
|
||||
0x3, 0x2, 0x2, 0x2, 0x112, 0x114, 0x5, 0x49, 0x25, 0x2, 0x113, 0x112,
|
||||
0x3, 0x2, 0x2, 0x2, 0x113, 0x114, 0x3, 0x2, 0x2, 0x2, 0x114, 0x11d,
|
||||
0x3, 0x2, 0x2, 0x2, 0x115, 0x117, 0x5, 0x45, 0x23, 0x2, 0x116, 0x115,
|
||||
0x3, 0x2, 0x2, 0x2, 0x117, 0x118, 0x3, 0x2, 0x2, 0x2, 0x118, 0x116,
|
||||
0x3, 0x2, 0x2, 0x2, 0x118, 0x119, 0x3, 0x2, 0x2, 0x2, 0x119, 0x11a,
|
||||
0x3, 0x2, 0x2, 0x2, 0x11a, 0x11b, 0x5, 0x49, 0x25, 0x2, 0x11b, 0x11d,
|
||||
0x3, 0x2, 0x2, 0x2, 0x11c, 0xe0, 0x3, 0x2, 0x2, 0x2, 0x11c, 0xfd, 0x3,
|
||||
0x2, 0x2, 0x2, 0x11c, 0x107, 0x3, 0x2, 0x2, 0x2, 0x11c, 0x116, 0x3,
|
||||
0x2, 0x2, 0x2, 0x11d, 0x4e, 0x3, 0x2, 0x2, 0x2, 0x11e, 0x138, 0x7, 0x32,
|
||||
0x2, 0x2, 0x11f, 0x123, 0x9, 0x7, 0x2, 0x2, 0x120, 0x122, 0x9, 0x2,
|
||||
0x2, 0x2, 0x121, 0x120, 0x3, 0x2, 0x2, 0x2, 0x122, 0x125, 0x3, 0x2,
|
||||
0x2, 0x2, 0x123, 0x121, 0x3, 0x2, 0x2, 0x2, 0x123, 0x124, 0x3, 0x2,
|
||||
0x2, 0x2, 0x124, 0x138, 0x3, 0x2, 0x2, 0x2, 0x125, 0x123, 0x3, 0x2,
|
||||
0x2, 0x2, 0x126, 0x128, 0x7, 0x32, 0x2, 0x2, 0x127, 0x129, 0x9, 0x8,
|
||||
0x2, 0x2, 0x128, 0x127, 0x3, 0x2, 0x2, 0x2, 0x129, 0x12a, 0x3, 0x2,
|
||||
0x2, 0x2, 0x12a, 0x128, 0x3, 0x2, 0x2, 0x2, 0x12a, 0x12b, 0x3, 0x2,
|
||||
0x2, 0x2, 0x12b, 0x138, 0x3, 0x2, 0x2, 0x2, 0x12c, 0x12d, 0x7, 0x32,
|
||||
0x2, 0x2, 0x12d, 0x131, 0x7, 0x7a, 0x2, 0x2, 0x12e, 0x12f, 0x7, 0x32,
|
||||
0x2, 0x2, 0x12f, 0x131, 0x7, 0x5a, 0x2, 0x2, 0x130, 0x12c, 0x3, 0x2,
|
||||
0x2, 0x2, 0x130, 0x12e, 0x3, 0x2, 0x2, 0x2, 0x131, 0x133, 0x3, 0x2,
|
||||
0x2, 0x2, 0x132, 0x134, 0x9, 0x3, 0x2, 0x2, 0x133, 0x132, 0x3, 0x2,
|
||||
0x2, 0x2, 0x134, 0x135, 0x3, 0x2, 0x2, 0x2, 0x135, 0x133, 0x3, 0x2,
|
||||
0x2, 0x2, 0x135, 0x136, 0x3, 0x2, 0x2, 0x2, 0x136, 0x138, 0x3, 0x2,
|
||||
0x2, 0x2, 0x137, 0x11e, 0x3, 0x2, 0x2, 0x2, 0x137, 0x11f, 0x3, 0x2,
|
||||
0x2, 0x2, 0x137, 0x126, 0x3, 0x2, 0x2, 0x2, 0x137, 0x130, 0x3, 0x2,
|
||||
0x2, 0x2, 0x138, 0x50, 0x3, 0x2, 0x2, 0x2, 0x139, 0x13d, 0x9, 0x9, 0x2,
|
||||
0x2, 0x13a, 0x13c, 0x9, 0xa, 0x2, 0x2, 0x13b, 0x13a, 0x3, 0x2, 0x2,
|
||||
0x2, 0x13c, 0x13f, 0x3, 0x2, 0x2, 0x2, 0x13d, 0x13b, 0x3, 0x2, 0x2,
|
||||
0x2, 0x13d, 0x13e, 0x3, 0x2, 0x2, 0x2, 0x13e, 0x52, 0x3, 0x2, 0x2, 0x2,
|
||||
0x13f, 0x13d, 0x3, 0x2, 0x2, 0x2, 0x140, 0x142, 0x9, 0xb, 0x2, 0x2,
|
||||
0x141, 0x140, 0x3, 0x2, 0x2, 0x2, 0x142, 0x143, 0x3, 0x2, 0x2, 0x2,
|
||||
0x143, 0x141, 0x3, 0x2, 0x2, 0x2, 0x143, 0x144, 0x3, 0x2, 0x2, 0x2,
|
||||
0x144, 0x145, 0x3, 0x2, 0x2, 0x2, 0x145, 0x146, 0x8, 0x2a, 0x2, 0x2,
|
||||
0x146, 0x54, 0x3, 0x2, 0x2, 0x2, 0x147, 0x148, 0x7, 0x31, 0x2, 0x2,
|
||||
0x148, 0x149, 0x7, 0x31, 0x2, 0x2, 0x149, 0x14d, 0x3, 0x2, 0x2, 0x2,
|
||||
0x14a, 0x14c, 0xa, 0xc, 0x2, 0x2, 0x14b, 0x14a, 0x3, 0x2, 0x2, 0x2,
|
||||
0x14c, 0x14f, 0x3, 0x2, 0x2, 0x2, 0x14d, 0x14b, 0x3, 0x2, 0x2, 0x2,
|
||||
0x14d, 0x14e, 0x3, 0x2, 0x2, 0x2, 0x14e, 0x150, 0x3, 0x2, 0x2, 0x2,
|
||||
0x14f, 0x14d, 0x3, 0x2, 0x2, 0x2, 0x150, 0x151, 0x8, 0x2b, 0x2, 0x2,
|
||||
0x151, 0x56, 0x3, 0x2, 0x2, 0x2, 0x152, 0x153, 0x7, 0x31, 0x2, 0x2,
|
||||
0x153, 0x154, 0x7, 0x2c, 0x2, 0x2, 0x154, 0x158, 0x3, 0x2, 0x2, 0x2,
|
||||
0x155, 0x157, 0xb, 0x2, 0x2, 0x2, 0x156, 0x155, 0x3, 0x2, 0x2, 0x2,
|
||||
0x157, 0x15a, 0x3, 0x2, 0x2, 0x2, 0x158, 0x159, 0x3, 0x2, 0x2, 0x2,
|
||||
0x158, 0x156, 0x3, 0x2, 0x2, 0x2, 0x159, 0x15b, 0x3, 0x2, 0x2, 0x2,
|
||||
0x15a, 0x158, 0x3, 0x2, 0x2, 0x2, 0x15b, 0x15c, 0x7, 0x2c, 0x2, 0x2,
|
||||
0x15c, 0x15d, 0x7, 0x31, 0x2, 0x2, 0x15d, 0x15e, 0x3, 0x2, 0x2, 0x2,
|
||||
0x15e, 0x15f, 0x8, 0x2c, 0x2, 0x2, 0x15f, 0x58, 0x3, 0x2, 0x2, 0x2,
|
||||
0x1d, 0x2, 0xcc, 0xd1, 0xd5, 0xda, 0xe0, 0xe5, 0xeb, 0xf2, 0xf7, 0xf9,
|
||||
0x101, 0x104, 0x109, 0x10f, 0x113, 0x118, 0x11c, 0x123, 0x12a, 0x130,
|
||||
0x135, 0x137, 0x13d, 0x143, 0x14d, 0x158, 0x3, 0x8, 0x2, 0x2,
|
||||
};
|
||||
|
||||
atn::ATNDeserializer deserializer;
|
||||
_atn = deserializer.deserialize(_serializedATN);
|
||||
|
||||
size_t count = _atn.getNumberOfDecisions();
|
||||
_decisionToDFA.reserve(count);
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
_decisionToDFA.emplace_back(_atn.getDecisionState(i), i);
|
||||
}
|
||||
}
|
||||
|
||||
SysYLexer::Initializer SysYLexer::_init;
|
||||
@ -0,0 +1,62 @@
|
||||
|
||||
// Generated from SysY.g4 by ANTLR 4.7.2
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "antlr4-runtime.h"
|
||||
|
||||
|
||||
|
||||
|
||||
class SysYLexer : public antlr4::Lexer {
|
||||
public:
|
||||
enum {
|
||||
T__0 = 1, T__1 = 2, T__2 = 3, T__3 = 4, T__4 = 5, T__5 = 6, T__6 = 7,
|
||||
T__7 = 8, T__8 = 9, T__9 = 10, T__10 = 11, T__11 = 12, T__12 = 13, T__13 = 14,
|
||||
T__14 = 15, T__15 = 16, T__16 = 17, T__17 = 18, T__18 = 19, T__19 = 20,
|
||||
T__20 = 21, T__21 = 22, T__22 = 23, T__23 = 24, T__24 = 25, T__25 = 26,
|
||||
T__26 = 27, T__27 = 28, T__28 = 29, T__29 = 30, T__30 = 31, T__31 = 32,
|
||||
T__32 = 33, FloatConst = 34, IntConst = 35, Ident = 36, WS = 37, LINE_COMMENT = 38,
|
||||
BLOCK_COMMENT = 39
|
||||
};
|
||||
|
||||
SysYLexer(antlr4::CharStream *input);
|
||||
~SysYLexer();
|
||||
|
||||
virtual std::string getGrammarFileName() const override;
|
||||
virtual const std::vector<std::string>& getRuleNames() const override;
|
||||
|
||||
virtual const std::vector<std::string>& getChannelNames() const override;
|
||||
virtual const std::vector<std::string>& getModeNames() const override;
|
||||
virtual const std::vector<std::string>& getTokenNames() const override; // deprecated, use vocabulary instead
|
||||
virtual antlr4::dfa::Vocabulary& getVocabulary() const override;
|
||||
|
||||
virtual const std::vector<uint16_t> getSerializedATN() const override;
|
||||
virtual const antlr4::atn::ATN& getATN() const override;
|
||||
|
||||
private:
|
||||
static std::vector<antlr4::dfa::DFA> _decisionToDFA;
|
||||
static antlr4::atn::PredictionContextCache _sharedContextCache;
|
||||
static std::vector<std::string> _ruleNames;
|
||||
static std::vector<std::string> _tokenNames;
|
||||
static std::vector<std::string> _channelNames;
|
||||
static std::vector<std::string> _modeNames;
|
||||
|
||||
static std::vector<std::string> _literalNames;
|
||||
static std::vector<std::string> _symbolicNames;
|
||||
static antlr4::dfa::Vocabulary _vocabulary;
|
||||
static antlr4::atn::ATN _atn;
|
||||
static std::vector<uint16_t> _serializedATN;
|
||||
|
||||
|
||||
// Individual action functions triggered by action() above.
|
||||
|
||||
// Individual semantic predicate functions triggered by sempred() above.
|
||||
|
||||
struct Initializer {
|
||||
Initializer();
|
||||
};
|
||||
static Initializer _init;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,513 @@
|
||||
|
||||
// Generated from SysY.g4 by ANTLR 4.7.2
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "antlr4-runtime.h"
|
||||
|
||||
|
||||
|
||||
|
||||
class SysYParser : public antlr4::Parser {
|
||||
public:
|
||||
enum {
|
||||
T__0 = 1, T__1 = 2, T__2 = 3, T__3 = 4, T__4 = 5, T__5 = 6, T__6 = 7,
|
||||
T__7 = 8, T__8 = 9, T__9 = 10, T__10 = 11, T__11 = 12, T__12 = 13, T__13 = 14,
|
||||
T__14 = 15, T__15 = 16, T__16 = 17, T__17 = 18, T__18 = 19, T__19 = 20,
|
||||
T__20 = 21, T__21 = 22, T__22 = 23, T__23 = 24, T__24 = 25, T__25 = 26,
|
||||
T__26 = 27, T__27 = 28, T__28 = 29, T__29 = 30, T__30 = 31, T__31 = 32,
|
||||
T__32 = 33, FloatConst = 34, IntConst = 35, Ident = 36, WS = 37, LINE_COMMENT = 38,
|
||||
BLOCK_COMMENT = 39
|
||||
};
|
||||
|
||||
enum {
|
||||
RuleCompUnit = 0, RuleDecl = 1, RuleConstDecl = 2, RuleBType = 3, RuleConstDef = 4,
|
||||
RuleConstInitVal = 5, RuleVarDecl = 6, RuleVarDef = 7, RuleInitVal = 8,
|
||||
RuleFuncDef = 9, RuleFuncType = 10, RuleFuncFParams = 11, RuleFuncFParam = 12,
|
||||
RuleBlock = 13, RuleBlockItem = 14, RuleStmt = 15, RuleExp = 16, RuleCond = 17,
|
||||
RuleLVal = 18, RulePrimaryExp = 19, RuleNumber = 20, RuleUnaryExp = 21,
|
||||
RuleUnaryOp = 22, RuleFuncRParams = 23, RuleMulExp = 24, RuleAddExp = 25,
|
||||
RuleRelExp = 26, RuleEqExp = 27, RuleLAndExp = 28, RuleLOrExp = 29,
|
||||
RuleConstExp = 30
|
||||
};
|
||||
|
||||
SysYParser(antlr4::TokenStream *input);
|
||||
~SysYParser();
|
||||
|
||||
virtual std::string getGrammarFileName() const override;
|
||||
virtual const antlr4::atn::ATN& getATN() const override { return _atn; };
|
||||
virtual const std::vector<std::string>& getTokenNames() const override { return _tokenNames; }; // deprecated: use vocabulary instead.
|
||||
virtual const std::vector<std::string>& getRuleNames() const override;
|
||||
virtual antlr4::dfa::Vocabulary& getVocabulary() const override;
|
||||
|
||||
|
||||
class CompUnitContext;
|
||||
class DeclContext;
|
||||
class ConstDeclContext;
|
||||
class BTypeContext;
|
||||
class ConstDefContext;
|
||||
class ConstInitValContext;
|
||||
class VarDeclContext;
|
||||
class VarDefContext;
|
||||
class InitValContext;
|
||||
class FuncDefContext;
|
||||
class FuncTypeContext;
|
||||
class FuncFParamsContext;
|
||||
class FuncFParamContext;
|
||||
class BlockContext;
|
||||
class BlockItemContext;
|
||||
class StmtContext;
|
||||
class ExpContext;
|
||||
class CondContext;
|
||||
class LValContext;
|
||||
class PrimaryExpContext;
|
||||
class NumberContext;
|
||||
class UnaryExpContext;
|
||||
class UnaryOpContext;
|
||||
class FuncRParamsContext;
|
||||
class MulExpContext;
|
||||
class AddExpContext;
|
||||
class RelExpContext;
|
||||
class EqExpContext;
|
||||
class LAndExpContext;
|
||||
class LOrExpContext;
|
||||
class ConstExpContext;
|
||||
|
||||
class CompUnitContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
CompUnitContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
std::vector<DeclContext *> decl();
|
||||
DeclContext* decl(size_t i);
|
||||
std::vector<FuncDefContext *> funcDef();
|
||||
FuncDefContext* funcDef(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
CompUnitContext* compUnit();
|
||||
|
||||
class DeclContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
DeclContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
ConstDeclContext *constDecl();
|
||||
VarDeclContext *varDecl();
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
DeclContext* decl();
|
||||
|
||||
class ConstDeclContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
ConstDeclContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
BTypeContext *bType();
|
||||
std::vector<ConstDefContext *> constDef();
|
||||
ConstDefContext* constDef(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
ConstDeclContext* constDecl();
|
||||
|
||||
class BTypeContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
BTypeContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
BTypeContext* bType();
|
||||
|
||||
class ConstDefContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
ConstDefContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
antlr4::tree::TerminalNode *Ident();
|
||||
ConstInitValContext *constInitVal();
|
||||
std::vector<ConstExpContext *> constExp();
|
||||
ConstExpContext* constExp(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
ConstDefContext* constDef();
|
||||
|
||||
class ConstInitValContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
ConstInitValContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
ConstExpContext *constExp();
|
||||
std::vector<ConstInitValContext *> constInitVal();
|
||||
ConstInitValContext* constInitVal(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
ConstInitValContext* constInitVal();
|
||||
|
||||
class VarDeclContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
VarDeclContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
BTypeContext *bType();
|
||||
std::vector<VarDefContext *> varDef();
|
||||
VarDefContext* varDef(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
VarDeclContext* varDecl();
|
||||
|
||||
class VarDefContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
VarDefContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
antlr4::tree::TerminalNode *Ident();
|
||||
std::vector<ConstExpContext *> constExp();
|
||||
ConstExpContext* constExp(size_t i);
|
||||
InitValContext *initVal();
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
VarDefContext* varDef();
|
||||
|
||||
class InitValContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
InitValContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
ExpContext *exp();
|
||||
std::vector<InitValContext *> initVal();
|
||||
InitValContext* initVal(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
InitValContext* initVal();
|
||||
|
||||
class FuncDefContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
FuncDefContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
FuncTypeContext *funcType();
|
||||
antlr4::tree::TerminalNode *Ident();
|
||||
BlockContext *block();
|
||||
FuncFParamsContext *funcFParams();
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
FuncDefContext* funcDef();
|
||||
|
||||
class FuncTypeContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
FuncTypeContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
FuncTypeContext* funcType();
|
||||
|
||||
class FuncFParamsContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
FuncFParamsContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
std::vector<FuncFParamContext *> funcFParam();
|
||||
FuncFParamContext* funcFParam(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
FuncFParamsContext* funcFParams();
|
||||
|
||||
class FuncFParamContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
FuncFParamContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
BTypeContext *bType();
|
||||
antlr4::tree::TerminalNode *Ident();
|
||||
std::vector<ExpContext *> exp();
|
||||
ExpContext* exp(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
FuncFParamContext* funcFParam();
|
||||
|
||||
class BlockContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
BlockContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
std::vector<BlockItemContext *> blockItem();
|
||||
BlockItemContext* blockItem(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
BlockContext* block();
|
||||
|
||||
class BlockItemContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
BlockItemContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
DeclContext *decl();
|
||||
StmtContext *stmt();
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
BlockItemContext* blockItem();
|
||||
|
||||
class StmtContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
StmtContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
LValContext *lVal();
|
||||
ExpContext *exp();
|
||||
BlockContext *block();
|
||||
CondContext *cond();
|
||||
std::vector<StmtContext *> stmt();
|
||||
StmtContext* stmt(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
StmtContext* stmt();
|
||||
|
||||
class ExpContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
ExpContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
AddExpContext *addExp();
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
ExpContext* exp();
|
||||
|
||||
class CondContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
CondContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
LOrExpContext *lOrExp();
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
CondContext* cond();
|
||||
|
||||
class LValContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
LValContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
antlr4::tree::TerminalNode *Ident();
|
||||
std::vector<ExpContext *> exp();
|
||||
ExpContext* exp(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
LValContext* lVal();
|
||||
|
||||
class PrimaryExpContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
PrimaryExpContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
ExpContext *exp();
|
||||
LValContext *lVal();
|
||||
NumberContext *number();
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
PrimaryExpContext* primaryExp();
|
||||
|
||||
class NumberContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
NumberContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
antlr4::tree::TerminalNode *FloatConst();
|
||||
antlr4::tree::TerminalNode *IntConst();
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
NumberContext* number();
|
||||
|
||||
class UnaryExpContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
UnaryExpContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
PrimaryExpContext *primaryExp();
|
||||
antlr4::tree::TerminalNode *Ident();
|
||||
FuncRParamsContext *funcRParams();
|
||||
UnaryOpContext *unaryOp();
|
||||
UnaryExpContext *unaryExp();
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
UnaryExpContext* unaryExp();
|
||||
|
||||
class UnaryOpContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
UnaryOpContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
UnaryOpContext* unaryOp();
|
||||
|
||||
class FuncRParamsContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
FuncRParamsContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
std::vector<ExpContext *> exp();
|
||||
ExpContext* exp(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
FuncRParamsContext* funcRParams();
|
||||
|
||||
class MulExpContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
MulExpContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
std::vector<UnaryExpContext *> unaryExp();
|
||||
UnaryExpContext* unaryExp(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
MulExpContext* mulExp();
|
||||
|
||||
class AddExpContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
AddExpContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
std::vector<MulExpContext *> mulExp();
|
||||
MulExpContext* mulExp(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
AddExpContext* addExp();
|
||||
|
||||
class RelExpContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
RelExpContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
std::vector<AddExpContext *> addExp();
|
||||
AddExpContext* addExp(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
RelExpContext* relExp();
|
||||
|
||||
class EqExpContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
EqExpContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
std::vector<RelExpContext *> relExp();
|
||||
RelExpContext* relExp(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
EqExpContext* eqExp();
|
||||
|
||||
class LAndExpContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
LAndExpContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
std::vector<EqExpContext *> eqExp();
|
||||
EqExpContext* eqExp(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
LAndExpContext* lAndExp();
|
||||
|
||||
class LOrExpContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
LOrExpContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
std::vector<LAndExpContext *> lAndExp();
|
||||
LAndExpContext* lAndExp(size_t i);
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
LOrExpContext* lOrExp();
|
||||
|
||||
class ConstExpContext : public antlr4::ParserRuleContext {
|
||||
public:
|
||||
ConstExpContext(antlr4::ParserRuleContext *parent, size_t invokingState);
|
||||
virtual size_t getRuleIndex() const override;
|
||||
AddExpContext *addExp();
|
||||
|
||||
virtual antlrcpp::Any accept(antlr4::tree::ParseTreeVisitor *visitor) override;
|
||||
|
||||
};
|
||||
|
||||
ConstExpContext* constExp();
|
||||
|
||||
|
||||
private:
|
||||
static std::vector<antlr4::dfa::DFA> _decisionToDFA;
|
||||
static antlr4::atn::PredictionContextCache _sharedContextCache;
|
||||
static std::vector<std::string> _ruleNames;
|
||||
static std::vector<std::string> _tokenNames;
|
||||
|
||||
static std::vector<std::string> _literalNames;
|
||||
static std::vector<std::string> _symbolicNames;
|
||||
static antlr4::dfa::Vocabulary _vocabulary;
|
||||
static antlr4::atn::ATN _atn;
|
||||
static std::vector<uint16_t> _serializedATN;
|
||||
|
||||
|
||||
struct Initializer {
|
||||
Initializer();
|
||||
};
|
||||
static Initializer _init;
|
||||
};
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
|
||||
// Generated from SysY.g4 by ANTLR 4.7.2
|
||||
|
||||
|
||||
#include "SysYVisitor.h"
|
||||
|
||||
|
||||
@ -0,0 +1,86 @@
|
||||
|
||||
// Generated from SysY.g4 by ANTLR 4.7.2
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "antlr4-runtime.h"
|
||||
#include "SysYParser.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This class defines an abstract visitor for a parse tree
|
||||
* produced by SysYParser.
|
||||
*/
|
||||
class SysYVisitor : public antlr4::tree::AbstractParseTreeVisitor {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Visit parse trees produced by SysYParser.
|
||||
*/
|
||||
virtual antlrcpp::Any visitCompUnit(SysYParser::CompUnitContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitDecl(SysYParser::DeclContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitConstDecl(SysYParser::ConstDeclContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitBType(SysYParser::BTypeContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitConstDef(SysYParser::ConstDefContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitConstInitVal(SysYParser::ConstInitValContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitVarDecl(SysYParser::VarDeclContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitVarDef(SysYParser::VarDefContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitInitVal(SysYParser::InitValContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitFuncDef(SysYParser::FuncDefContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitFuncType(SysYParser::FuncTypeContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitFuncFParams(SysYParser::FuncFParamsContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitFuncFParam(SysYParser::FuncFParamContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitBlock(SysYParser::BlockContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitBlockItem(SysYParser::BlockItemContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitStmt(SysYParser::StmtContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitExp(SysYParser::ExpContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitCond(SysYParser::CondContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitLVal(SysYParser::LValContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitPrimaryExp(SysYParser::PrimaryExpContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitNumber(SysYParser::NumberContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitUnaryExp(SysYParser::UnaryExpContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitUnaryOp(SysYParser::UnaryOpContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitFuncRParams(SysYParser::FuncRParamsContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitMulExp(SysYParser::MulExpContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitAddExp(SysYParser::AddExpContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitRelExp(SysYParser::RelExpContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitEqExp(SysYParser::EqExpContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitLAndExp(SysYParser::LAndExpContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitLOrExp(SysYParser::LOrExpContext *context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitConstExp(SysYParser::ConstExpContext *context) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@ -0,0 +1,95 @@
|
||||
#include "irgen/IRGen.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#include "SysYParser.h"
|
||||
#include "utils/Log.h"
|
||||
|
||||
// 内部辅助:不依赖类成员,只需 ConstEnv。
|
||||
namespace {
|
||||
|
||||
int EvalAddExp(SysYParser::AddExpContext* ctx,
|
||||
const IRGenImpl::ConstEnv& env);
|
||||
int EvalMulExp(SysYParser::MulExpContext* ctx,
|
||||
const IRGenImpl::ConstEnv& env);
|
||||
int EvalUnaryExp(SysYParser::UnaryExpContext* ctx,
|
||||
const IRGenImpl::ConstEnv& env);
|
||||
|
||||
int EvalPrimary(SysYParser::PrimaryExpContext* ctx,
|
||||
const IRGenImpl::ConstEnv& env) {
|
||||
if (!ctx) throw std::runtime_error(FormatError("consteval", "空主表达式"));
|
||||
if (ctx->number()) {
|
||||
if (!ctx->number()->ILITERAL())
|
||||
throw std::runtime_error(
|
||||
FormatError("consteval", "constExp 不支持浮点字面量"));
|
||||
return std::stoi(ctx->number()->getText());
|
||||
}
|
||||
if (ctx->exp()) return EvalAddExp(ctx->exp()->addExp(), env);
|
||||
if (ctx->lValue()) {
|
||||
if (!ctx->lValue()->ID())
|
||||
throw std::runtime_error(FormatError("consteval", "非法 lValue"));
|
||||
const std::string name = ctx->lValue()->ID()->getText();
|
||||
auto it = env.find(name);
|
||||
if (it == env.end())
|
||||
throw std::runtime_error(
|
||||
FormatError("consteval", "constExp 引用非 const 变量: " + name));
|
||||
return it->second;
|
||||
}
|
||||
throw std::runtime_error(FormatError("consteval", "不支持的主表达式形式"));
|
||||
}
|
||||
|
||||
int EvalUnaryExp(SysYParser::UnaryExpContext* ctx,
|
||||
const IRGenImpl::ConstEnv& env) {
|
||||
if (!ctx) throw std::runtime_error(FormatError("consteval", "空一元表达式"));
|
||||
if (ctx->primaryExp()) return EvalPrimary(ctx->primaryExp(), env);
|
||||
if (ctx->unaryOp() && ctx->unaryExp()) {
|
||||
int v = EvalUnaryExp(ctx->unaryExp(), env);
|
||||
if (ctx->unaryOp()->SUB()) return -v;
|
||||
if (ctx->unaryOp()->ADD()) return v;
|
||||
if (ctx->unaryOp()->NOT()) return (v == 0) ? 1 : 0;
|
||||
}
|
||||
throw std::runtime_error(
|
||||
FormatError("consteval", "函数调用不能出现在 constExp 中"));
|
||||
}
|
||||
|
||||
int EvalMulExp(SysYParser::MulExpContext* ctx,
|
||||
const IRGenImpl::ConstEnv& env) {
|
||||
if (!ctx) throw std::runtime_error(FormatError("consteval", "空乘法表达式"));
|
||||
if (ctx->mulExp()) {
|
||||
int lhs = EvalMulExp(ctx->mulExp(), env);
|
||||
int rhs = EvalUnaryExp(ctx->unaryExp(), env);
|
||||
if (ctx->MUL()) return lhs * rhs;
|
||||
if (ctx->DIV()) { if (!rhs) throw std::runtime_error("除以零"); return lhs / rhs; }
|
||||
if (ctx->MOD()) { if (!rhs) throw std::runtime_error("模零"); return lhs % rhs; }
|
||||
throw std::runtime_error(FormatError("consteval", "未知乘法运算符"));
|
||||
}
|
||||
return EvalUnaryExp(ctx->unaryExp(), env);
|
||||
}
|
||||
|
||||
int EvalAddExp(SysYParser::AddExpContext* ctx,
|
||||
const IRGenImpl::ConstEnv& env) {
|
||||
if (!ctx) throw std::runtime_error(FormatError("consteval", "空加法表达式"));
|
||||
if (ctx->addExp()) {
|
||||
int lhs = EvalAddExp(ctx->addExp(), env);
|
||||
int rhs = EvalMulExp(ctx->mulExp(), env);
|
||||
if (ctx->ADD()) return lhs + rhs;
|
||||
if (ctx->SUB()) return lhs - rhs;
|
||||
throw std::runtime_error(FormatError("consteval", "未知加法运算符"));
|
||||
}
|
||||
return EvalMulExp(ctx->mulExp(), env);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int IRGenImpl::EvalConstExpr(SysYParser::ConstExpContext* ctx) const {
|
||||
if (!ctx || !ctx->addExp())
|
||||
throw std::runtime_error(FormatError("consteval", "空 constExp"));
|
||||
return EvalAddExp(ctx->addExp(), const_env_);
|
||||
}
|
||||
|
||||
int IRGenImpl::EvalExpAsConst(SysYParser::ExpContext* ctx) const {
|
||||
if (!ctx || !ctx->addExp())
|
||||
throw std::runtime_error(FormatError("consteval", "空 exp"));
|
||||
return EvalAddExp(ctx->addExp(), const_env_);
|
||||
}
|
||||
Loading…
Reference in new issue