[Snek] [keith-packard/snek] 96606a: Remove more inappropriate terminology

Keith Packard noreply at github.com
Sat Aug 29 16:22:17 PDT 2020


  Branch: refs/heads/main
  Home:   https://github.com/keith-packard/snek
  Commit: 96606a99f5e8f1483a63135f0a985763919415ee
      https://github.com/keith-packard/snek/commit/96606a99f5e8f1483a63135f0a985763919415ee
  Author: Keith Packard <keithp at keithp.com>
  Date:   2020-08-29 (Sat, 29 Aug 2020)

  Changed paths:
    M ao/ao-product.c
    M chips/samd21/samd21.h

  Log Message:
  -----------
  Remove more inappropriate terminology

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: e9f248fc2cf9105efe06020eb35a68be8bad2505
      https://github.com/keith-packard/snek/commit/e9f248fc2cf9105efe06020eb35a68be8bad2505
  Author: Keith Packard <keithp at keithp.com>
  Date:   2020-08-29 (Sat, 29 Aug 2020)

  Changed paths:
    M snek-gram.ll

  Log Message:
  -----------
  Merge 'is' handling with other comparison ops

Not sure why this was split into a separate production, but it
should be the same.

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: d595a476be9432574e792ecf90b1c3569adc5bdf
      https://github.com/keith-packard/snek/commit/d595a476be9432574e792ecf90b1c3569adc5bdf
  Author: Keith Packard <keithp at keithp.com>
  Date:   2020-08-29 (Sat, 29 Aug 2020)

  Changed paths:
    M snek-lex.c

  Log Message:
  -----------
  Clean up lexer a bit

Use helper functions lextoken/unlextoken to track token
content. Improve token content saved from 'trailing' function so that
errors look good.

Remove 'assign_op' parameter from check_equal; it can
be computed.

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: 2f1f01759e01ccb9e2732d65fdef14971767e3d6
      https://github.com/keith-packard/snek/commit/2f1f01759e01ccb9e2732d65fdef14971767e3d6
  Author: Keith Packard <keithp at keithp.com>
  Date:   2020-08-29 (Sat, 29 Aug 2020)

  Changed paths:
    M snek-gram.ll
    M snek-parse.c

  Log Message:
  -----------
  Use inlines for common parse actions instead of gotos

This reduces the number of actions required as lola will merge
multiple identical actions together.

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: 8daf29b6c9316dd490951954fb02d1b9fc782392
      https://github.com/keith-packard/snek/commit/8daf29b6c9316dd490951954fb02d1b9fc782392
  Author: Keith Packard <keithp at keithp.com>
  Date:   2020-08-29 (Sat, 29 Aug 2020)

  Changed paths:
    M snek-gram.ll
    M snek-parse.c

  Log Message:
  -----------
  Replace 'bool' usage with 'offset' in the grammar

Alas, lola isn't smart enough to optimize things that generate
nearly equivalent code, so @ value_push_bool(false); @ generates
a different action than @ valaue_push_offset(0); @.

Deal with this by just using offset everywhere, and using zero offset
as false and non-zero offset as true. This makes the code a bit less
obvious, but saves a bunch of space.

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: 2e4600f391ae74219e028651a6da60f1e577ac97
      https://github.com/keith-packard/snek/commit/2e4600f391ae74219e028651a6da60f1e577ac97
  Author: Keith Packard <keithp at keithp.com>
  Date:   2020-08-29 (Sat, 29 Aug 2020)

  Changed paths:
    M chips/atmega/snek-atmega.h
    M ports/duemilanove/Makefile
    M ports/uno/Makefile

  Log Message:
  -----------
  ports/duemilanove, ports/uno: Fix RAM address and size

The 328p has ram from 0x100 through 0x8ff, so set the data origin to
0x100 and the length to 0x720, leaving 0xe0 bytes for stack.

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: 7a9b0213d0c1e7dadb1a441e123532b15decb647
      https://github.com/keith-packard/snek/commit/7a9b0213d0c1e7dadb1a441e123532b15decb647
  Author: Keith Packard <keithp at keithp.com>
  Date:   2020-08-29 (Sat, 29 Aug 2020)

  Changed paths:
    M snek-code.c
    M snek-exec.c
    M snek-gram.ll
    M snek.h

  Log Message:
  -----------
  Handle 'chained' comparison operators

Python supports expressions of the form:

	a < b < c

where < can be replaced with any comparison operator. This is
converted into the natural conjunction:

	a < b && b < c

except that 'b' is only evaluated once.

To support this in snek, new op codes have been introduced which:

 1. Perform the comparison operation
 2a. If the resulting value is false
	set the accumulator to the false value
	branch to the offset specified as a parameter
 2b. If the resulting value is true
	leave the accumulator with the previous value
	skip over the offset in the instruction

When compiling, the original comparison opcode for all but the last
comparison are replaced with these new 'chain' comparison op codes.

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: f31585ba18e423312df4e424292a0d49d4bb6479
      https://github.com/keith-packard/snek/commit/f31585ba18e423312df4e424292a0d49d4bb6479
  Author: Keith Packard <keithp at keithp.com>
  Date:   2020-08-29 (Sat, 29 Aug 2020)

  Changed paths:
    M test/Makefile
    A test/generate-chain-op.py
    A test/pass-chain-op.py

  Log Message:
  -----------
  test: Add test for chaining of comparison operators

Make sure sequences of comparison operators generate correct results.
The test was generated by running:

	$ python3 generate-chain-op.py | python3

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: 3d0c93148fdb42e0bc707faf76a63fb063ea05ff
      https://github.com/keith-packard/snek/commit/3d0c93148fdb42e0bc707faf76a63fb063ea05ff
  Author: Keith Packard <keithp at keithp.com>
  Date:   2020-08-29 (Sat, 29 Aug 2020)

  Changed paths:
    M snek-parse.c

  Log Message:
  -----------
  Add TOKEN_NAMES when debugging the parser

This makes the parser debug output a lot more usable as it
prints token names rather than token indices

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: a6f6925712b62c993c168bc1c35752b8c699fbc0
      https://github.com/keith-packard/snek/commit/a6f6925712b62c993c168bc1c35752b8c699fbc0
  Author: Keith Packard <keithp at keithp.com>
  Date:   2020-08-29 (Sat, 29 Aug 2020)

  Changed paths:
    M snek-gram.ll

  Log Message:
  -----------
  Clean up grammar a bit

Re-order operations to create more similar actions and tails of
actions. This lets the compiler share code more effectively.

Add some comments describing actions.

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: 95383a28b25ee88107dc91233ec7531a60d44c04
      https://github.com/keith-packard/snek/commit/95383a28b25ee88107dc91233ec7531a60d44c04
  Author: Keith Packard <keithp at keithp.com>
  Date:   2020-08-29 (Sat, 29 Aug 2020)

  Changed paths:
    M snek-gram.ll

  Log Message:
  -----------
  Use a single value to indicate tuple status

Replace the boolean+length with a single value which is negative when
the parenthesized expression is not a tuple (a) and the length of the
tuple when it is a tuple. This saves space on the value stack during
parsing and shrinks the code a bit.

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: 9d4636458b26216664df8a6c47dbf0982ac921e5
      https://github.com/keith-packard/snek/commit/9d4636458b26216664df8a6c47dbf0982ac921e5
  Author: Keith Packard <keithp at keithp.com>
  Date:   2020-08-29 (Sat, 29 Aug 2020)

  Changed paths:
    M snek-gram.ll

  Log Message:
  -----------
  Get rid of production used to work-around lola bug

Before version 1.4, lola had a bug when computing the follow set for
non-terminal that was repeated in a production. It would only compute
the values for the *first* instance of the non-terminal in the
production and not for subsequent instances. Hence this kludge which
split the dict-ent production in half so that 'expr' occurred only
once in each production. With that bug fixed, snek can now use a shorter
grammar and save some time and space while parsing.

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: b10e53d19cc75a7cc9014d5107fb65ebfd1eefa5
      https://github.com/keith-packard/snek/commit/b10e53d19cc75a7cc9014d5107fb65ebfd1eefa5
  Author: Keith Packard <keithp at keithp.com>
  Date:   2020-08-29 (Sat, 29 Aug 2020)

  Changed paths:
    M snek-parse.c

  Log Message:
  -----------
  Report OOM errors during parsing

Otherwise the user is just confused when the parser restarts in the
middle of input.

Signed-off-by: Keith Packard <keithp at keithp.com>


Compare: https://github.com/keith-packard/snek/compare/80ba4181bcc5...b10e53d19cc7


More information about the Snek mailing list