Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YueScript as an additional scripting language #2743

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,12 @@ jobs:
cd build
emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_LUA=OFF -DBUILD_WITH_MOON=ON -DTIC80_TARGET=tic80moon .. --fresh
cmake --build . --parallel

- name: Build yue
run: |
cd build
emcmake cmake -DBUILD_SDLGPU=On -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_LUA=OFF -DBUILD_WITH_YUE=ON -DTIC80_TARGET=tic80yue .. --fresh
cmake --build . --parallel

- name: Build fennel
run: |
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,7 @@
path = vendor/pocketpy
url = https://github.com/PrimedErwin/pocketpy.git
shallow = true
[submodule "vendor/yuescript"]
path = vendor/yuescript
url = https://github.com/IppClub/YueScript.git
shallow = true
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ include(cmake/tools.cmake)

include(cmake/lua.cmake)
include(cmake/moon.cmake)
include(cmake/yue.cmake)
include(cmake/fennel.cmake)
include(cmake/wren.cmake)
include(cmake/mruby.cmake)
Expand Down
4 changes: 4 additions & 0 deletions assets.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ build\bin\prj2cart demos\sfx.lua build\sfx.tic
build\bin\prj2cart demos\squirreldemo.nut build\squirreldemo.tic
build\bin\prj2cart demos\tetris.lua build\tetris.tic
build\bin\prj2cart demos\wrendemo.wren build\wrendemo.tic
build\bin\prj2cart demos\yuedemo.yue build\yuedemo.tic

build\bin\wasmp2cart demos\wasm\wasmdemo.wasmp build\wasmdemo.tic --binary demos\wasm\wasmdemo.wasm
build\bin\wasmp2cart demos\bunny\wasmmark\wasmmark.wasmp build\wasmmark.tic --binary demos\bunny\wasmmark\wasmmark.wasm
Expand All @@ -34,6 +35,7 @@ build\bin\prj2cart demos\bunny\rubymark.rb build\rubymark.tic
build\bin\prj2cart demos\bunny\schememark.scm build\schememark.tic
build\bin\prj2cart demos\bunny\squirrelmark.nut build\squirrelmark.tic
build\bin\prj2cart demos\bunny\wrenmark.wren build\wrenmark.tic
build\bin\prj2cart demos\bunny\yuemark.yue build\yuemark.tic

build\bin\bin2txt build\config.tic build\assets\config.tic.dat -z
build\bin\bin2txt build\luademo.tic build\assets\luademo.tic.dat -z
Expand Down Expand Up @@ -69,5 +71,7 @@ build\bin\bin2txt build\squirrelmark.tic build\assets\squirrelmark.tic.dat -z
build\bin\bin2txt build\wasmmark.tic build\assets\wasmmark.tic.dat -z
build\bin\bin2txt build\wrenmark.tic build\assets\wrenmark.tic.dat -z
build\bin\bin2txt build\wasmdemo.tic build\assets\wasmdemo.tic.dat -z
build\bin\bin2txt build\yuedemo.tic build\assets\yuedemo.tic.dat -z
build\bin\bin2txt build\yuemark.tic build\assets\yuemark.tic.dat -z

build\bin\bin2txt build\cart.png build\assets\cart.png.dat
1 change: 1 addition & 0 deletions build/assets/yuedemo.tic.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x78, 0xda, 0xed, 0x52, 0xcd, 0x4a, 0xc3, 0x40, 0x10, 0xde, 0xfa, 0x73, 0xc8, 0x1e, 0x04, 0xdf, 0x60, 0x14, 0x04, 0x7f, 0x52, 0x4d, 0xda, 0x22, 0x5a, 0x88, 0x17, 0x15, 0x2c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 0xb6, 0x73, 0xd3, 0xbe, 0xd8, 0xda, 0x36, 0x4f, 0x1a, 0xf8, 0x51, 0x43, 0xe8, 0xfb, 0xde, 0x01, 0x2b, 0x07, 0x25, 0xd7,
1 change: 1 addition & 0 deletions build/assets/yuemark.tic.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x78, 0xda, 0xed, 0x55, 0xcd, 0x6f, 0xdc, 0x44, 0x14, 0x77, 0x0e, 0x54, 0xb2, 0xc5, 0x4a, 0xeb, 0x2b, 0xe2, 0xf0, 0x52, 0x84, 0xba, 0x9b, 0xee, 0x6e, 0xed, 0x4d, 0xb2, 0x20, 0x37, 0x1b, 0x2d, 0x05, 0x21, 0x22, 0x15, 0x09, 0x91, 0xd0, 0x10, 0xa9, 0x39, 0xcc, 0x7a, 0x67, 0xd7, 0x16, 0xfe, 0x58, 0xc6, 0xe3, 0xa4, 0x56, 0xd5, 0x6b, 0x4f, 0x1c, 0xf9, 0x03, 0x38, 0xc1, 0x15, 0x4e, 0xdc, 0xb9, 0x21, 0x6d, 0xa4, 0xfc, 0x01, 0x71, 0x54, 0xfe, 0x00, 0xb6, 0x1c, 0x22, 0x38, 0xc2, 0x1b, 0x8f, 0xed, 0xfd, 0x68, 0xd3, 0xf4, 0x06, 0x48, 0x19, 0xed, 0x73, 0xec, 0xf7, 0x7e, 0xbf, 0xf7, 0x66, 0xde, 0xc7, 0xe4, 0x4d, 0x43, 0x51, 0xde, 0x7a, 0xbb, 0x71, 0x78, 0xeb, 0xf0, 0xa7, 0xed, 0xdd, 0xe7, 0x4f, 0xf6, 0xff, 0x3e, 0x89, 0x7f, 0xf8, 0x63, 0xfc, 0xfe, 0xcf, 0x83, 0x77, 0xbf, 0x4e, 0xea, 0x9d, 0xf0, 0xee, 0xe1, 0xaf, 0x1f, 0x7c, 0xff, 0x67, 0xf4, 0xfc, 0xaf, 0x8b, 0x8b, 0x8b, 0x6f, 0x7f, 0xfc, 0xe5, 0x81, 0xf7, 0x74, 0x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d, 0xf0, 0x88, 0xce, 0xe8, 0x66, 0x5d, 0xc6, 0xff, 0x22, 0x1b, 0x13, 0x4d, 0xb2, 0x1a, 0x80, 0x63, 0xe5, 0x8b, 0x8b, 0x76, 0x4c, 0x5c, 0x16, 0x15, 0x97, 0xa4, 0xa8, 0x21, 0xea, 0x1f, 0xca, 0x91, 0x5a, 0x95, 0xc4, 0x8f, 0x70, 0x2c, 0x35, 0xd5, 0xf6, 0xa2, 0x9a, 0xb9, 0x59, 0x7f, 0x3d, 0xbe, 0x98, 0x64, 0xc1, 0x66, 0xd4, 0xe6, 0x35, 0x39, 0xad, 0x73, 0xe3, 0xd4, 0x58, 0x6c, 0x4d, 0x34, 0xa3, 0x5b, 0x1c, 0xf4, 0x80, 0xd7, 0x6e, 0xde, 0x93, 0x8e, 0x2c, 0xb8, 0x09, 0xad, 0x16, 0xbc, 0x33, 0x3b, 0x45, 0xe6, 0xc4, 0xc4, 0x3f, 0x43, 0x82, 0x69, 0xc8, 0x14, 0xd9, 0xdb, 0x8c, 0x8a, 0x85, 0xcf, 0x69, 0xd8, 0x08, 0x0f, 0x8b, 0xee, 0x5c, 0x5d, 0xbc, 0xfd, 0xee, 0x40, 0xfb, 0x72, 0x4f, 0xff, 0x00, 0xc8, 0xda, 0xa8, 0x50,
2 changes: 1 addition & 1 deletion build/baremetalpi/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ get_filename_component(ARM_TOOLCHAIN_DIR ${BINUTILS_PATH} DIRECTORY)
# Now squirrel works.
# Ideally should use the CFLAGS defined in circle build files, not hardwire them here too.
# For RPI2
#set(CMAKE_C_FLAGS " -DMINIZ_NO_TIME -DTIC_BUILD_WITH_FENNEL -DTIC_BUILD_WITH_MOON -DTIC_BUILD_WITH_JS -DTIC_BUILD_WITH_WREN -DTIC_BUILD_WITH_LUA -DLUA_32BITS -std=c99 -march=armv7-a+neon-vfpv4 -D AARCH=32 -D __circle__ -D BAREMETALPI --specs=nosys.specs -O3 -mabi=aapcs -marm -mfloat-abi=hard -mfpu=neon-vfpv4 -D__DYNAMIC_REENT__")
#set(CMAKE_C_FLAGS " -DMINIZ_NO_TIME -DTIC_BUILD_WITH_FENNEL -DTIC_BUILD_WITH_MOON -DTIC_BUILD_WITH_YUE -DTIC_BUILD_WITH_JS -DTIC_BUILD_WITH_WREN -DTIC_BUILD_WITH_LUA -DLUA_32BITS -std=c99 -march=armv7-a+neon-vfpv4 -D AARCH=32 -D __circle__ -D BAREMETALPI --specs=nosys.specs -O3 -mabi=aapcs -marm -mfloat-abi=hard -mfpu=neon-vfpv4 -D__DYNAMIC_REENT__")
# For RPI3
# investigate -funsafe-math-optimizations and -march=armv8-a+crc -mcpu=cortex-a53
set(CMAKE_C_FLAGS " -DMINIZ_NO_TIME -DLUA_32BITS -std=c99 -march=armv8-a -D AARCH=32 -mtune=cortex-a53 -D __circle__ -D BAREMETALPI --specs=nosys.specs -O3 -marm -mfloat-abi=hard -mfpu=neon-fp-armv8 -funsafe-math-optimizations -D__DYNAMIC_REENT__")
Expand Down
5 changes: 5 additions & 0 deletions cmake/core.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ target_include_directories(tic80core
PRIVATE
${THIRDPARTY_DIR}/moonscript
${THIRDPARTY_DIR}/fennel
${THIRDPARTY_DIR}/yuescript
${POCKETPY_DIR}/src
PUBLIC
${CMAKE_SOURCE_DIR}/include
Expand All @@ -70,6 +71,10 @@ if(BUILD_STATIC)
target_link_libraries(tic80core PRIVATE moon)
endif()

if(BUILD_WITH_YUE)
target_link_libraries(tic80core PRIVATE yuescript)
endif()

if(BUILD_WITH_FENNEL)
target_link_libraries(tic80core PRIVATE fennel)
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/lua.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
option(BUILD_WITH_LUA "Lua Enabled" ON)
message("BUILD_WITH_LUA: ${BUILD_WITH_LUA}")

if(BUILD_WITH_LUA OR BUILD_WITH_MOON OR BUILD_WITH_FENNEL)
if(BUILD_WITH_LUA OR BUILD_WITH_MOON OR BUILD_WITH_YUE OR BUILD_WITH_FENNEL)
set(LUA_DIR ${THIRDPARTY_DIR}/lua)
set(LUA_SRC
${LUA_DIR}/lapi.c
Expand Down
84 changes: 84 additions & 0 deletions cmake/yue.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
################################
# YUESCRIPT
################################

option(BUILD_WITH_YUE "Yue Enabled" ${BUILD_WITH_ALL})
message("BUILD_WITH_YUE: ${BUILD_WITH_YUE}")

if(BUILD_WITH_YUE)
set(YUESCRIPT_DIR ${THIRDPARTY_DIR}/yuescript)
set(YUESCRIPT_SRC
${YUESCRIPT_DIR}/src/yuescript/ast.cpp
${YUESCRIPT_DIR}/src/yuescript/parser.cpp
${YUESCRIPT_DIR}/src/yuescript/yue_ast.cpp
${YUESCRIPT_DIR}/src/yuescript/yue_parser.cpp
${YUESCRIPT_DIR}/src/yuescript/yue_compiler.cpp
${YUESCRIPT_DIR}/src/yuescript/yuescript.cpp
)

list(APPEND YUESCRIPT_SRC ${CMAKE_SOURCE_DIR}/src/api/yue.cpp)
list(APPEND YUESCRIPT_SRC ${CMAKE_SOURCE_DIR}/src/api/parse_note.c)

add_library(yuescript ${TIC_RUNTIME} ${YUESCRIPT_SRC})

if(NOT BUILD_STATIC)
set_target_properties(yuescript PROPERTIES PREFIX "")
else()
target_compile_definitions(yuescript INTERFACE TIC_BUILD_WITH_YUE)
endif()

target_link_libraries(yuescript
PRIVATE
runtime
luaapi
)

set_target_properties(yuescript PROPERTIES
LINKER_LANGUAGE CXX
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
)

target_include_directories(yuescript
PRIVATE
${YUESCRIPT_DIR}/src
${YUESCRIPT_DIR}/src/yuescript
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/api
)

target_compile_definitions(yuescript PRIVATE
YUE_NO_MACRO
$<$<BOOL:${MSVC}>:_SCL_SECURE_NO_WARNINGS>
)

# Platform specific configurations
if(BAREMETALPI OR NINTENDO_3DS)
# Disable thread-safe statics on embedded platforms for C++ files
set_source_files_properties(
${YUESCRIPT_SRC}
PROPERTIES COMPILE_FLAGS "-fno-threadsafe-statics -fno-rtti -fno-thread-local-storage"
)

# Force static linking for baremetal
set_target_properties(yuescript PROPERTIES
STATIC_LIBRARY TRUE
POSITION_INDEPENDENT_CODE FALSE
)

target_compile_features(yuescript PRIVATE cxx_std_17)
target_compile_options(yuescript PRIVATE -fno-thread-local-storage -fno-rtti)
endif()

if(MSVC)
target_compile_definitions(yuescript PRIVATE _SCL_SECURE_NO_WARNINGS)
else()
target_compile_options(yuescript PRIVATE -Wall -Wno-long-long -fPIC -O3)
endif()

if(APPLE)
target_compile_options(yuescript PRIVATE -Wno-deprecated-declarations)
endif()

endif()
114 changes: 114 additions & 0 deletions demos/bunny/yuemark.yue
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
-- title: Bunnymark in YueScript
-- author: Rob Loach
-- desc: Benchmarking tool to see how many bunnies can fly around the screen, using YueScript.
-- license: MIT License
-- input: gamepad
-- script: yue
-- version: 1.1.0

screenWidth = 240
screenHeight = 136
toolbarHeight = 6
t = 0

class Bunny
@width: 26
@height: 32

new: =>
@x = math.random(0, screenWidth - @@width)
@y = math.random(0, screenHeight - @@height)
@speedX = math.random(-100, 100) / 60
@speedY = math.random(-100, 100) / 60
@sprite = 1

draw: () =>
spr(@sprite, @x, @y, 1, 1, 0, 0, 4, 4)

update: () =>
@x += @speedX
@y += @speedY

if @x + @@width > screenWidth
@x = screenWidth - @@width
@speedX *= -1
if @x < 0
@x = 0
@speedX *= -1
if @y + @@height > screenHeight
@y = screenHeight - @@height
@speedY *= -1
if @y < toolbarHeight
@y = toolbarHeight
@speedY *= -1

class FPS
new: =>
@value = 0
@frames = 0
@lastTime = 0

getValue: () =>
if time() - @lastTime <= 1000
@frames += 1
else
@value = @frames
@frames = 0
@lastTime = time()
return @value

fps = FPS!
bunnies = {}
table.insert(bunnies, Bunny!)

global TIC=->
-- music
if t == 0 then
music(0)
if t == 6*64*2.375 then
music(1)
t = t + 1

-- Input
if btn(0)
for i = 1, 5
table.insert(bunnies, Bunny!)
elseif btn(1)
for i = 1, 5
table.remove(bunnies, 1)

-- Update
for i, item in pairs bunnies
item\update!

-- Draw
cls(15)
for i, item in pairs bunnies
item\draw!

rect(0, 0, screenWidth, toolbarHeight, 0)
print("Bunnies: " .. #bunnies, 1, 0, 11, false, 1, false)
print("FPS: " .. fps\getValue!, screenWidth / 2, 0, 11, false, 1, false)

-- <TILES>
-- 001:11111100111110dd111110dc111110dc111110dc111110dc111110dd111110dd
-- 002:00011110ddd0110dccd0110dccd0110dccd0110dccd0110dcddd00dddddddddd
-- 003:00001111dddd0111cccd0111cccd0111cccd0111cccd0111dcdd0111dddd0111
-- 004:1111111111111111111111111111111111111111111111111111111111111111
-- 017:111110dd111110dd111110dd111110dd10000ddd1eeeeddd1eeeeedd10000eed
-- 018:d0ddddddd0ddddddddddddddddd0000dddddccddddddccdddddddddddddddddd
-- 019:0ddd01110ddd0111dddd0111dddd0111ddddd000ddddddddddddddddddddd000
-- 020:1111111111111111111111111111111101111111d0111111d011111101111111
-- 033:111110ee111110ee111110ee111110ee111110ee111110ee111110ee111110ee
-- 034:dddcccccddccccccddccccccddccccccddccccccdddcccccdddddddddddddddd
-- 035:dddd0111cddd0111cddd0111cddd0111cddd0111dddd0111dddd0111dddd0111
-- 036:1111111111111111111111111111111111111111111111111111111111111111
-- 049:111110ee111110ee111110ee111110ee111110ee111110ee111110ee11111100
-- 050:dddeeeeeddeeeeeed00000000111111101111111011111110111111111111111
-- 051:eddd0111eedd01110eed011110ee011110ee011110ee011110ee011111001111
-- 052:1111111111111111111111111111111111111111111111111111111111111111
-- </TILES>

-- <PALETTE>
-- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
-- </PALETTE>
Loading
Loading