remove output from lexer, fixes
This commit is contained in:
@@ -24,6 +24,15 @@ SOURCES = \
|
|||||||
$(wildcard ./src/libecmaobjects/*.c) \
|
$(wildcard ./src/libecmaobjects/*.c) \
|
||||||
$(wildcard ./src/liballocator/*.c) \
|
$(wildcard ./src/liballocator/*.c) \
|
||||||
$(wildcard ./src/libcoreint/*.c) )
|
$(wildcard ./src/libcoreint/*.c) )
|
||||||
|
|
||||||
|
HEADERS = \
|
||||||
|
$(sort \
|
||||||
|
$(wildcard ./src/*.h) \
|
||||||
|
$(wildcard ./src/libperipherals/*.h) \
|
||||||
|
$(wildcard ./src/libjsparser/*.h) \
|
||||||
|
$(wildcard ./src/libecmaobjects/*.h) \
|
||||||
|
$(wildcard ./src/liballocator/*.h) \
|
||||||
|
$(wildcard ./src/libcoreint/*.h) )
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
-I src \
|
-I src \
|
||||||
@@ -66,7 +75,7 @@ RELEASE_OPTIONS = -Os -Werror
|
|||||||
|
|
||||||
DEFINES = -DMEM_HEAP_CHUNK_SIZE=256 -DMEM_HEAP_AREA_SIZE=32768
|
DEFINES = -DMEM_HEAP_CHUNK_SIZE=256 -DMEM_HEAP_AREA_SIZE=32768
|
||||||
|
|
||||||
.PHONY: all debug release clean install test
|
.PHONY: all debug release clean check install
|
||||||
|
|
||||||
all: debug
|
all: debug
|
||||||
|
|
||||||
@@ -86,12 +95,11 @@ clean:
|
|||||||
rm -f $(TARGET).map
|
rm -f $(TARGET).map
|
||||||
rm -f $(TARGET).hex
|
rm -f $(TARGET).hex
|
||||||
rm -f $(TARGET).lst
|
rm -f $(TARGET).lst
|
||||||
|
rm -f jerry.error js.files
|
||||||
|
|
||||||
check:
|
check:
|
||||||
cppcheck ./src/ --enable=all --std=c99 -v
|
cppcheck $(HEADERS) $(SOURCES) --enable=all --std=c99
|
||||||
|
./tools/jerry_test.sh
|
||||||
|
|
||||||
install:
|
install:
|
||||||
st-flash write $(TARGET).bin 0x08000000
|
st-flash write $(TARGET).bin 0x08000000
|
||||||
|
|
||||||
test:
|
|
||||||
./tools/jerry_test.sh
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
when the body is not a string literal.
|
when the body is not a string literal.
|
||||||
- Limit Unicode support
|
- Limit Unicode support
|
||||||
- Cut Number from 64bit to 32bit/16/8bit
|
- Cut Number from 64bit to 32bit/16/8bit
|
||||||
|
- Limit recursion level
|
||||||
- Do not allow addition, deletion or assignment to the properties of built-in
|
- Do not allow addition, deletion or assignment to the properties of built-in
|
||||||
objects.
|
objects.
|
||||||
This limitation is needed to support a more efficient implementation based
|
This limitation is needed to support a more efficient implementation based
|
||||||
|
|||||||
+17
-11
@@ -59,7 +59,7 @@ typedef signed int int32_t;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Variable that must not be referenced.
|
* Variable that must not be referenced.
|
||||||
*
|
*
|
||||||
* May be used for static assertion checks.
|
* May be used for static assertion checks.
|
||||||
*/
|
*/
|
||||||
extern uint32_t jerry_UnreferencedExpression;
|
extern uint32_t jerry_UnreferencedExpression;
|
||||||
@@ -87,14 +87,14 @@ extern uint32_t jerry_UnreferencedExpression;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Aligns @value to @alignment.
|
* Aligns @value to @alignment.
|
||||||
*
|
*
|
||||||
* Returns maximum positive value, that divides @alignment and is less than or equal to @value
|
* Returns maximum positive value, that divides @alignment and is less than or equal to @value
|
||||||
*/
|
*/
|
||||||
#define JERRY_ALIGNDOWN( value, alignment) ( (alignment) * ( (value) / (alignment) ) )
|
#define JERRY_ALIGNDOWN( value, alignment) ( (alignment) * ( (value) / (alignment) ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aligns @value to @alignment.
|
* Aligns @value to @alignment.
|
||||||
*
|
*
|
||||||
* Returns minimum positive value, that divides @alignment and is more than or equal to @value
|
* Returns minimum positive value, that divides @alignment and is more than or equal to @value
|
||||||
*/
|
*/
|
||||||
#define JERRY_ALIGNUP( value, alignment) ( (alignment) * ( ((value) + (alignment) - 1) / (alignment) ) )
|
#define JERRY_ALIGNUP( value, alignment) ( (alignment) * ( ((value) + (alignment) - 1) / (alignment) ) )
|
||||||
@@ -108,19 +108,23 @@ extern uint32_t jerry_UnreferencedExpression;
|
|||||||
/**
|
/**
|
||||||
* Bit-fields
|
* Bit-fields
|
||||||
*/
|
*/
|
||||||
inline uint32_t jerry_ExtractBitField(uint32_t value, uint32_t lsb, uint32_t width);
|
inline uint32_t jerry_ExtractBitField(uint32_t value, uint32_t lsb,
|
||||||
inline uint32_t jerry_SetBitFieldValue(uint32_t value, uint32_t bitFieldValue, uint32_t lsb, uint32_t width);
|
uint32_t width);
|
||||||
|
inline uint32_t jerry_SetBitFieldValue(uint32_t value, uint32_t bitFieldValue,
|
||||||
|
uint32_t lsb, uint32_t width);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract a bit-field from the integer.
|
* Extract a bit-field from the integer.
|
||||||
*
|
*
|
||||||
* @return bit-field's value
|
* @return bit-field's value
|
||||||
*/
|
*/
|
||||||
inline uint32_t
|
inline uint32_t
|
||||||
jerry_ExtractBitField(uint32_t container, /**< container to extract bit-field from */
|
jerry_ExtractBitField(uint32_t
|
||||||
|
container, /**< container to extract bit-field from */
|
||||||
uint32_t lsb, /**< least significant bit of the value
|
uint32_t lsb, /**< least significant bit of the value
|
||||||
* to be extracted */
|
* to be extracted */
|
||||||
uint32_t width) /**< width of the bit-field to be extracted */ {
|
uint32_t width) /**< width of the bit-field to be extracted */
|
||||||
|
{
|
||||||
JERRY_ASSERT(lsb < JERRY_BITSINBYTE * sizeof (uint32_t));
|
JERRY_ASSERT(lsb < JERRY_BITSINBYTE * sizeof (uint32_t));
|
||||||
JERRY_ASSERT((lsb + width) <= JERRY_BITSINBYTE * sizeof (uint32_t));
|
JERRY_ASSERT((lsb + width) <= JERRY_BITSINBYTE * sizeof (uint32_t));
|
||||||
|
|
||||||
@@ -132,15 +136,17 @@ jerry_ExtractBitField(uint32_t container, /**< container to extract bit-field fr
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract a bit-field from the integer.
|
* Extract a bit-field from the integer.
|
||||||
*
|
*
|
||||||
* @return bit-field's value
|
* @return bit-field's value
|
||||||
*/
|
*/
|
||||||
inline uint32_t
|
inline uint32_t
|
||||||
jerry_SetBitFieldValue(uint32_t container, /**< container to insert bit-field to */
|
jerry_SetBitFieldValue(uint32_t
|
||||||
|
container, /**< container to insert bit-field to */
|
||||||
uint32_t newBitFieldValue, /**< value of bit-field to insert */
|
uint32_t newBitFieldValue, /**< value of bit-field to insert */
|
||||||
uint32_t lsb, /**< least significant bit of the value
|
uint32_t lsb, /**< least significant bit of the value
|
||||||
* to be extracted */
|
* to be extracted */
|
||||||
uint32_t width) /**< width of the bit-field to be extracted */ {
|
uint32_t width) /**< width of the bit-field to be extracted */
|
||||||
|
{
|
||||||
JERRY_ASSERT(lsb < JERRY_BITSINBYTE * sizeof (uint32_t));
|
JERRY_ASSERT(lsb < JERRY_BITSINBYTE * sizeof (uint32_t));
|
||||||
JERRY_ASSERT((lsb + width) <= JERRY_BITSINBYTE * sizeof (uint32_t));
|
JERRY_ASSERT((lsb + width) <= JERRY_BITSINBYTE * sizeof (uint32_t));
|
||||||
JERRY_ASSERT(newBitFieldValue <= (1u << width));
|
JERRY_ASSERT(newBitFieldValue <= (1u << width));
|
||||||
|
|||||||
@@ -32,28 +32,28 @@ gen_bytecode (FILE *src_file)
|
|||||||
assert (st);
|
assert (st);
|
||||||
while (st->type != STMT_EOF)
|
while (st->type != STMT_EOF)
|
||||||
{
|
{
|
||||||
pp_statement (st);
|
//pp_statement (st);
|
||||||
st = parser_parse_statement ();
|
st = parser_parse_statement ();
|
||||||
assert (st);
|
assert (st);
|
||||||
}
|
}
|
||||||
pp_finish ();
|
//pp_finish ();
|
||||||
|
|
||||||
FILE *file = fopen (FILE_NAME, "w+b");
|
// FILE *file = fopen (FILE_NAME, "w+b");
|
||||||
|
//
|
||||||
OPCODE op0;
|
// OPCODE op0;
|
||||||
|
//
|
||||||
save_op_loop_inf (file, op0, 1);
|
// save_op_loop_inf (file, op0, 1);
|
||||||
save_op_call_1 (file, op0, 0, LED_GREEN);
|
// save_op_call_1 (file, op0, 0, LED_GREEN);
|
||||||
save_op_call_1 (file, op0, 0, LED_BLUE);
|
// save_op_call_1 (file, op0, 0, LED_BLUE);
|
||||||
save_op_call_1 (file, op0, 0, LED_ORANGE);
|
// save_op_call_1 (file, op0, 0, LED_ORANGE);
|
||||||
save_op_call_1 (file, op0, 0, LED_RED);
|
// save_op_call_1 (file, op0, 0, LED_RED);
|
||||||
save_op_call_1 (file, op0, 0, LED_GREEN);
|
// save_op_call_1 (file, op0, 0, LED_GREEN);
|
||||||
save_op_call_1 (file, op0, 0, LED_BLUE);
|
// save_op_call_1 (file, op0, 0, LED_BLUE);
|
||||||
save_op_call_1 (file, op0, 0, LED_ORANGE);
|
// save_op_call_1 (file, op0, 0, LED_ORANGE);
|
||||||
save_op_call_1 (file, op0, 0, LED_RED);
|
// save_op_call_1 (file, op0, 0, LED_RED);
|
||||||
save_op_jmp (file, op0, 0);
|
// save_op_jmp (file, op0, 0);
|
||||||
|
//
|
||||||
fclose (file);
|
// fclose (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -39,9 +39,12 @@ OP_DEF (jmp)
|
|||||||
|
|
||||||
OP_DEF (decl) { };
|
OP_DEF (decl) { };
|
||||||
|
|
||||||
OP_DEF (named_func_decl) { };
|
OP_DEF (decl_func_named)
|
||||||
|
{
|
||||||
|
OP_TYPE_IDX name_literal_idx;
|
||||||
|
};
|
||||||
|
|
||||||
OP_DEF (anon_func_decl) { };
|
OP_DEF (decl_func_anon) { };
|
||||||
|
|
||||||
OP_DEF (decl_var_global) { };
|
OP_DEF (decl_var_global) { };
|
||||||
|
|
||||||
@@ -108,10 +111,11 @@ union __opdata
|
|||||||
OP (nop);
|
OP (nop);
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
OPCODE {
|
OPCODE{
|
||||||
opfunc opfunc_ptr;
|
opfunc opfunc_ptr;
|
||||||
union __opdata data;
|
union __opdata data;
|
||||||
} __packed;
|
}
|
||||||
|
__packed;
|
||||||
|
|
||||||
void save_op_jmp (FILE *, OPCODE, int);
|
void save_op_jmp (FILE *, OPCODE, int);
|
||||||
void save_op_call_1 (FILE *, OPCODE, int, int);
|
void save_op_call_1 (FILE *, OPCODE, int, int);
|
||||||
|
|||||||
@@ -793,5 +793,5 @@ lexer_save_token (token tok)
|
|||||||
void
|
void
|
||||||
lexer_dump_buffer_state ()
|
lexer_dump_buffer_state ()
|
||||||
{
|
{
|
||||||
printf ("%s\n", buffer);
|
//printf ("%s\n", buffer);
|
||||||
}
|
}
|
||||||
+1
-1
@@ -73,7 +73,7 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
//gen_bytecode (generated_source);
|
//gen_bytecode (generated_source);
|
||||||
gen_bytecode (file);
|
gen_bytecode (file);
|
||||||
run_int ();
|
//run_int ();
|
||||||
|
|
||||||
#ifdef __TARGET_MCU
|
#ifdef __TARGET_MCU
|
||||||
fake_exit ();
|
fake_exit ();
|
||||||
|
|||||||
Reference in New Issue
Block a user